Loading TOC...


   item as Sequence
) as String


Returns a string representing a JSON serialization of a given item sequence.

item A Sequence, typically containing a JavaScript Object, whose JSON serialization is returned. If you pass in a single value, it is treated as a Sequence with that single item; therefore, if you pass in an array, the array is treated as a single value (not as one value for each item in the array). If you mean to pass in the values of each item in the array, then you can call xdmp.arrayValues on the array.

Usage Notes

XML nodes are serialized to JSON strings.

JSON has no serialization for infinity, not a number, and negative 0, therefore if you try and serialize INF, -INF, NaN, or -0 as JSON, an exception is thrown. If you want to represent these values in some way in your serialized JSON, then you can catch the exception (with a try/catch, for example) and provide your own value for it.

XQuery maps (map:map types) serialize to JSON name-value pairs.


   => ["a", false]


  xdmp.fromJsonString('{ "a":111 }'));

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