MarkLogic 12 EA 1 Product Documentation
json:array

json:array(
   [$array as element(json:array)]
) as json:array

Summary

Creates a (JSON) array, which is like a sequence of values, but allows for nesting.

Parameters
array A serialized array element.

Example

xquery version "1.0-ml";

json:array(
  <json:array xmlns:json="http://marklogic.com/xdmp/json"
              xmlns:xs="http://www.w3.org/2001/XMLSchema"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <json:value xsi:type="xs:string">hello</json:value>
   <json:value xsi:type="xs:string">world</json:value>
   <json:array>
     <json:value xsi:type="xs:string">one</json:value>
     <json:value xsi:type="xs:string">two</json:value>
   </json:array>
  </json:array>
)
=> ["hello", "world", ["one", "two"]]
Powered by MarkLogic Server | Terms of Use | Privacy Policy