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.

An earlier version of this function, as defined in the July 2012 XSLT 3.0 Working Draft, is implemented in Saxon 9.4 to 9.6, and available provided XPath 3.0 is enabled.

See also:

fn:json-doc()

fn:json-to-xml()

fn:serialize()