
op:json-object( $properties as map:map* ) as map:map
This function constructs a JSON object with the specified properties. The object can be used as the value of a column in a row or passed to a builtin function.
| Parameters | |
|---|---|
| $properties | The properties to be used to contruct the object. This is constructed by the op:prop function. |
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()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.