Loading TOC...

json:array-with

json:array-with(
   $array as json:array,
   $item as item()*
) as json:array

Summary

Push a value to the end of the array, increasing the size of the array by one. Returns the array as the result.

Parameters
array An array.
item New entries.

Example

  let $a := json:to-array(1 to 3)
    =>json:array-with(4)
  return xdmp:to-json($a)
  => [1, 2, 3, 4]

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.