Loading TOC...

op.jsonDocument

op.jsonDocument(
   $rootContent as object
) as documentNode

Summary

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.

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.