Loading TOC...

MarkLogic 12 EA 2 Product Documentation
op:json-null

op:json-null() as map:map

Summary

This function constructs a JSON null node.

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-literals((
   map:entry("row",1)=>map:with("gp",1)=>map:with("nm","alpha")=>
   map:with("str","a")=>map:with("num",10)=>map:with("bool", true()  ),
   map:entry("row",2)=>map:with("gp",1)=>map:with("nm","beta" )=>
   map:with("str","b")=>map:with("num",20)=>map:with("bool", false() ),
   map:entry("row",3)=>map:with("gp",2)=>map:with("nm","gamma")=>
   map:with("str","c")=>map:with("num",30)=>map:with("bool", true()  ),
   map:entry("row",4)=>map:with("gp",2)=>map:with("nm","delta")=>
   map:with("str","d")=>map:with("num",40)=>map:with("bool", false() )
   ))
      => op:where(op:eq(op:col("gp"), 1))
      => op:select(("row",
	           op:as("node", op:json-array((
	               op:json-string(op:col("str")),
	               op:json-number(op:col("num")),
	               op:json-boolean(op:col("bool")),
	               op:json-null()
	           )))
         ))
      => op:order-by("row")
      => op:result()
  

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