fn:xml-to-json

Converts an XML tree, whose format corresponds to the XML representation of JSON defined in the specification, into a string conforming to the JSON grammar.

xml-to-json($input as node()?) ➔ xs:string?

Arguments

 

$input

node()?

The input XML tree

Result

xs:string?

xml-to-json($input as node()?, $options as map(*)) ➔ document-node()?

Arguments

 

$input

node()?

The input XML tree

 

$options

map(*)

Used to control the way in which the conversion takes place

Result

document-node()?

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 only option recognized is 'indent':true()|false(). For full details see the specification.

See also:

fn:json-to-xml()