Loading TOC...

json:array-push

json:array-push(
   array as json:array,
   item as item()*
) as empty-sequence()

Summary

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

Parameters
array An array.
item New entries.

Example

  let $a := json:to-array(1 to 3)
  let $_ := json:array-push($a, 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.