<pre class="brush:xquery">
json-doc("http://ip.jsontest.com/")('ip') (: returns your IP address :)
</pre>
===fn:json-to-xml===
; Signatures
* <code>fn:json-to-xml($string as xs:string?) as node()?</code>
Converts a JSON string to an XML node representation.
<pre class="brush:xquery">
json-to-xml('{ "message": "world" }')
(: result:
<map xmlns="http://www.w3.org/2005/xpath-functions/json">
<string key="message">world</string>
</map> :)
</pre>
===fn:xml-to-json===
; Signatures
* <code>fn:xml-to-json($node as node()?) as xs:string?</code>
Converts an XML node, whose format conforms to the results created by [[#fn:json-to-xml|json-to-xml]], to a JSON string representation.
<pre class="brush:xquery">
(: returns "JSON" :)
xml-to-json(<string xmlns="http://www.w3.org/2005/xpath-functions/json">JSON</string>)
</pre>
=Changelog=
;Version 8.2
* Added: [[#fn:json-to-xml|fn:json-to-xml]], [[#fn:xml-to-json|fn:xml-to-json]].
;Version 8.1
* Updated: arrays are now based on an efficient [http://en.wikipedia.org/wiki/Finger_tree Finger Tree] implementation.