Loading TOC...

MarkLogic 10 Product Documentation
xdmp.fromJsonString

xdmp.fromJsonString(
   arg as String
) as Sequence

Summary

Parses a string as JSON, returning an item sequence.

Parameters
arg JSON input to be parsed.

Usage Notes

A JSON object or string is parsed as a json:object.

The JSON null value is represented as the empty sequence, and serializes in a way that indicates it is a null value. Therefore, when the null value is returned to JSON via xdmp:to-json, the null value is preserved.

Nested arrays in JSON are turned into nested sets of json:arrays.

Any codepoints in the JSON string that aren't allowed in XML are rejected and an error is thrown.

Example

xdmp.fromJsonString('["a", null, false]');
=>
["a",null,false]

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