MarkLogic Server 11.0 Product Documentation
op:json-array

op:json-array(
   $items as item()*
) as map:map

Summary

This function constructs a JSON array during row processing. The array can be used as the value of a column in a row or passed to a builtin expression function. The node is constructed during processing of the plan, rather than when building the plan.

Parameters
$items The JSON nodes for the array.

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