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($node as node()?, $options as map(*)?:={}) ➔ xs:string?

Arguments

 

$node

node()?

The input XML tree

 

$options

map(*)?

:= {}

Used to control the way in which the conversion takes place

Result

xs:string?

Namespace

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

Links to W3C specifications

XPath 3.1 Functions and Operators

XPath 4.0 Functions and Operators

XSLT 3.0 Specification

Saxon availability

Available in XPath 3.1, XSLT 3.0, XQuery 3.1, and later versions. Available in all Saxon editions. Implemented since Saxon 9.7. Available for all platforms.

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()