Loading TOC...

MarkLogic 12 EA 2 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

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