op.jsonDocument( rootContent as object ) as documentNode
This function constructs a JSON document with the root content, which must be exactly one JSON object or array node.
Parameters | |
---|---|
rootContent | The JSON object or array node used to construct the JSON document. |
const op = require('/MarkLogic/optic'); op.fromView('main', 'employees') .select(op.as('Employee', op.jsonDocument( op.jsonObject([ op.prop('Position', op.jsonString(op.col('Position'))), op.prop('ID', op.jsonArray([ op.jsonNumber(op.col('EmployeeID')) ])) ]) ))) .result();