MarkLogic 9 Product Documentation
op:json-document

op:json-document(
   $root as map:map
) as map:map

Summary

This function constructs a JSON document with the root content, which must be exactly one JSON object or array node.

Parameters
$root The JSON object or array node used to construct the JSON document.

Example


xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-view("main", "employees")
   => op:select(op:as("Employee", op:json-document(
	            op:json-object((
	                op:prop("Position", op:json-string(op:col("Position"))),
	                op:prop("ID", op:json-array(
	                        op:json-number(op:col("EmployeeID"))
	                ))
	            ))
	  )))
   => op:result()
  
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy