MarkLogic Server 11.0 Product Documentation
op:json-boolean

op:json-boolean(
   $value as item()
) as map:map

Summary

This function constructs a JSON boolean node with the specified value.

Parameters
$value The value of the JSON boolean 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()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy