Loading TOC...

xdmp and json functions (JSON)

The JSON built-in functions serialize XQuery items to JSON and read a JSON string and create XQuery items from it. JSON (JavaScript Object Notation) is a data-interchange format popular mechanism for passing data from JavaScript to other programming environments.

Functions for validating JSON with JSON schema.

20 functions
Function name Description
json:array Creates a (JSON) array, which is like a sequence of values, but allows for nesting.
json:array-pop Pop a value from the end of the array.
json:array-push Push a value to the end of the array, increasing the size of the array by one.
json:array-resize Resize the array to the new size.
json:array-set-javascript-by-ref If true is specified, sets a json:array to be passed to JavaScript by reference.
json:array-size Returns the size of the array.
json:array-values Returns the array values as an XQuery sequence.
json:array-with Push a value to the end of the array, increasing the size of the array by one.
json:null Returns the JSON null value, which is an empty sequence to XQuery, but not a Sequence when passed to JavaScript.
json:object Creates a JSON object, which is a kind of map with a fixed and ordered set of keys.
json:object-define Creates a JSON object.
json:set-item-at Sets a value in an array at a specified position.
json:subarray Extract a subarray from an array, producing a new array.
json:to-array Constructs json:array from a sequence of items.
xdmp:from-json Atomizes a JSON node, returning a JSON value.
xdmp:from-json-string Parses a string as JSON, returning an item sequence.
xdmp:json-validate Validate a JSON node against a JSON Schema.
xdmp:json-validate-node Validate a JSON node against a JSON Schema.
xdmp:to-json Constructs a JSON document.
xdmp:to-json-string Returns a string representing a JSON serialization of a given item sequence.