Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

JSON Path Module

isubiker edited this page Aug 24, 2011 · 2 revisions

JSON Path Module

Import statement

import module namespace path="http://marklogic.com/mljson/path-parser" at "lib/path-parser.xqy";

Note: Information about the path syntax can be found on the JSON Path page.

API Functions

path:parse

path:parse(
    $path as xs:string,
    $type as xs:string
) as xs:string

Parses the provided path into an XPath string. This is handy for testing but could also be used to construct eval statements or other such fanciness. The type paramater can be either "json" or "xml". When passed a type of "xml", the simplified XPath parser is used instead.


path:select

path:select(
    $doc as element(),
    $path as xs:string,
    $type as xs:string

) as element()*

Extracts the node (or nodes) from the given document using the provided JSON Path. The type paramater can be either "json" or "xml". When passed a type of "xml", the simplified XPath parser is used instead.

Clone this wiki locally