json.transformToJsonObject( node as Node, config as Object ) as Sequence
This function transforms an XML document to JSON and returns an object.
The supplied document (element or document node) is
transformed to JSON using the default (basic
) strategy
and returned as an object. The object will be either a
json:object
or json:array
.
When the default "basic" strategy is used, the XML node
must be in the http://marklogic.com/xdmp/json/basic
namespace.
const json = require('/MarkLogic/json/json.xqy'); json.transformToJsonObject( xdmp.unquote('<root><key>value</key></root>'), json.config('full')) /* The following JSON Object is produced: { "root": { "_children": [ { "key": { "_children": ["value"] } } ] } } */