fn:parse-json

This function takes as input a string in JSON format and parses it typically returning a map or array.

parse-json($json-text as xs:string?) ➔ item()?

Arguments

 

$json-text

xs:string?

The JSON input to be parsed

Result

item()?

parse-json($json-text as xs:string?, $options as map(*)) ➔ item()?

Arguments

 

$json-text

xs:string?

The JSON input to be parsed

 

$options

map(*)

Parsing options

Result

item()?

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

Notes on the Saxon implementation

Available since Saxon 9.7. The parsing options recognized are 'liberal':true()|false(), 'duplicates':'reject'|'use-first'|'retain', 'escape':true()|false(), 'fallback':(function). For full details see the specification. Use of the fallback option requires Saxon-PE or Saxon-EE.

When liberal=true(), the following extensions to the JSON grammar are accepted:

See also:

fn:json-doc()

fn:json-to-xml()

fn:serialize()