
op.prop( name as String, content as String ) as propertyDef
This function specifies the key expression and value content for a JSON property of a JSON object constructed by the op.jsonObject function.
| Parameters | |
|---|---|
| name | The key expression. This must evaluate to a string. |
| content | The value content. This must be exactly one JSON node expression. |
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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.