Loading TOC...

MarkLogic 12 EA 2 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();
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.