MarkLogic 9 Product Documentation
json:object

json:object(
   [$map as element(json:object)]
) as map:map

Summary

Creates a JSON object, which is a kind of map with a fixed and ordered set of keys.

Parameters
map A serialized JSON object.

Example

  json:object()
  => json:object(<json xmlns="http://marklogic.com/xdmp/json"/>)

Example

xquery version "1.0-ml";

let $obj :=
<json:object xmlns:json="http://marklogic.com/xdmp/json">
 <json:entry>
   <json:key>2</json:key>
   <json:value xsi:type="xs:string"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    world</json:value>
 </json:entry>
 <json:entry>
   <json:key>1</json:key>
   <json:value xsi:type="xs:string"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    hello</json:value>
 </json:entry>
</json:object>
return
map:keys(json:object($obj))
=>
2 1
Powered by MarkLogic Server | Terms of Use | Privacy Policy