MarkLogic 10 Product Documentation
op.jsonObject

op.jsonObject(
   properties as propertyDef
) as objectValue

Summary

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.

Example

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();
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy