Changes

Jump to navigation Jump to search
2,979 bytes removed ,  12:38, 18 October 2013
no edit summary
|-
| '''Summary'''
|Converts the JSON document specified by {{Code|$input}} to XML, and returns the result as {{Code|element(json)}} instance. The converted XML document is both well readable and lossless, i.e., the converted document can be serialized back to the original JSON representation.<br/>The {{Code|$options}} argument can be used to control the way the input is converted. The following options are available (they bear resemblance to the ones specified in [http://www.w3.org/TR/xslt-30/#json XSLT 3.0]):* {{Code|spec}} determines the used JSON specification. Allowed values are {{Code|RFC4627}}, {{Code|ECMA-262}}, and {{Code|liberal}}; the default is ({{Code|RFC4627}}).* {{Code|unescape}} determines whether escape sequences (marked by a backslash) in the input are expanded. The default is {{Code|true}}.* {{Code|format}} determines the conversion format. Allowed values are {{Code|json}}, {{Code|jsonml}}, and {{Code|map}}; the default is {{Code|json}}.Options can either be specified<br />* as children of an {{Code|<json:options/>}} element; e.g.:<pre class="brush:xml"><json:options> <json:format value='jsonml'/> ...</json:options></pre>* or as map, which contains all key/value pairs:<pre class="brush:xquery">{ 'format' : 'jsonml', ... }</pre>
|-
| '''Errors'''
|{{Error|BXJS0001|#Errors}} the specified input cannot be parsed as JSON document.<br/>{{Error|BXJS0003|#Errors}} a specified option cannot be parsed.
|}
|-
| '''Summary'''
|Serializes the node specified by {{Code|$input}} as JSON, and returns the result as {{Code|xs:string}} instance. The serialized node must conform to the syntax specified by the [[#json:parse|json:parse()]] function.<br />XML documents can also be serialized as JSON if the [[Serialization|Serialization Option]] {{Code|method}} is set to {{Code|json}}.<br/>The {{Code|$options}} argument can be used to control the way the input is serialized. The following options are available (they bear resemblance to the ones specified in [http://www.w3.org/TR/xslt-30/#json XSLT 3.0]):* {{Code|spec}} determines the used JSON specification. Allowed values are {{Code|RFC4627}}, {{Code|ECMA-262}}, and {{Code|liberal}}; the default is ({{Code|RFC4627}}).* {{Code|unescape}} determines whether escape sequences (marked by a backslash) in the input are expanded. The default is {{Code|true}}.* {{Code|format}} determines the conversion format. Allowed values are {{Code|json}} and {{Code|jsonml}}; the default is {{Code|json}}.Options can either be specified<br />* as children of an {{Code|<json:options/>}} element; e.g.:<pre class="brush:xml"><json:options> <json:format value='jsonml'/> ...</json:options></pre>* or as map, which contains all key/value pairs:<pre class="brush:xquery">{ 'format' : 'jsonml', ... }</pre>
|-
| '''Errors'''
|{{Error|BXJS0002|#Errors}} the specified node cannot be serialized as JSON document.
|}
 
==json:serialize-ml==
 
{{Version|7.7.2}}: deprecated; please use [[#json:serialize|json:serialize]] instead.
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|json:serialize-ml|$input as node()|xs:string}}
|-
| '''Summary'''
|Serializes the node specified by {{Code|$input}} and returns the result as {{Code|xs:string}} instance.<br />XML documents can also be output in the JsonML format by setting the [[Serialization|Serialization Option]] {{Code|method}} to {{Code|jsonml}}.
|-
| '''Errors'''
|{{Error|BXJS0002|#Errors}} the specified value cannot be serialized.
|}
 
==json:parse-ml==
 
{{Version|7.7.2}}: deprecated; please use [[#json:parse|json:parse]] instead.
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|json:parse-ml|$input as xs:string|element()}}
|-
| '''Summary'''
|Converts the [http://jsonml.org JsonML] document specified by {{Code|$input}} to XML, and returns the result as {{Code|element()}} instance. The JSON input must conform to the JsonML specification to be successfully converted.
|-
| '''Errors'''
|{{Error|BXJS0001|#Errors}} the specified input cannot be parsed as JsonML instance.
|}
|{{Code|BXJS0002}}
|The specified node cannot be serialized as JSON document.
|-
|{{Code|BXJS0003}}
|A specified option cannot be parsed.
|}
=Changelog=
 
;Version 7.8
* Removed: {{Code|json:parse-ml}}, {{Code|json:serialize-ml}}
;Version 7.7.2
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu