Changes

Jump to navigation Jump to search
2,762 bytes added ,  12:35, 18 October 2013
no edit summary
## As string is the default, it is by default omitted.
===Attributes Conversion===
The {{Code|attributes}} format is lossless, too. The transformation based on the following rules:
## As string is the default, it is by default omitted.
...===Map===
## If a name has the same type throughout the document, the The {{Code|typemap}} attribute will be omitted. Instead, the name will be listed in additional, type-specific attributes in the root nodeformat is lossless. The attributes conversion rules for are named by their type specified in the plural (''numbers'', ''booleans'', ''nulls'', ''objects'' and ''arrays''), and the attribute value contains all names with that type, separated by whitespaces[XSLT 3.0|http://www.w3.org/TR/xslt-30/#func-parse-json specification].
===JsonML===
The JsonML {{Code|jsonml}} format can be used to transform XML to JSON and back, using the JsonML dialect. JsonML allows the transformation of arbitrary XML documents, but namespaces, comments and processing instructions will be discarded in the transformation process. More details are found in the official [http://jsonml.org/XML JsonML documentation]. ==Options== The following options are available: {| class="wikitable sortable" width="100%"|- valign="top"! width="140" | Option! width="50%" | Description! Allowed! Default! Direction|- valign="top"| {{Code|format}}| Specifies the format for converting JSON data.| {{Code|direct}}, {{Code|attributes}}, {{Code|jsonml}}, {{Code|map}}| {{Code|direct}}| ''parse'', ''serialize''|- valign="top"| {{Code|spec}}| Determines the specification that is used for parsing JSON data:<br/>* {{Code|RFC4627}} allows no deviations from the grammar* {{Code|ECMA-262}} allows single values as input* {{Code|liberal}} allows single values and accepts keys without quotes, trailing commas and non-escaped control characters.| {{Code|RFC4627}}, {{Code|ECMA-262}}, {{Code|liberal}}| {{Code|liberal}}| ''parse'', ''serialize''|- valign="top"| {{Code|merge}}| This option is considered when {{Code|direct}} or {{Code|attributes}} conversion is used:<br/>* If a name has the same type throughout the document, the {{Code|type}} attribute will be omitted. Instead, the name will be listed in additional, type-specific attributes in the root node* The attributes are named by their type in plural (''numbers'', ''booleans'', ''nulls'', ''objects'' and ''arrays''), and the attribute value contains all names with that type, separated by whitespaces.| {{Code|yes}}, {{Code|no}}| {{Code|no}}| ''parse'', ''serialize''|- valign="top"| {{Code|strings}}| Indicates if {{Code|type}} attributes will be added for strings.| {{Code|yes}}, {{Code|no}}| {{Code|yes}}| ''parse'', ''serialize''|- valign="top"| {{Code|lax}}| Specifies if a lax approach is used to convert QNames to JSON names.| {{Code|yes}}, {{Code|no}}| {{Code|yes}}| ''parse'', ''serialize''|- valign="top"| {{Code|unescape}}| Indicates if escaped characters are expanded (for example, {{Code|\n}} becomes a single {{Code|x0A}} character, while {{Code|\u20AC}} becomes the character {{Code|€}}).| {{Code|yes}}, {{Code|no}}| {{Code|yes}}| ''parse''|- valign="top"| {{Code|escape}}| Indicates if characters are escaped whenever the JSON syntax requires it. This option can be set to {{Code|no}} if strings are already in escaped form and no further escaping is permitted.| {{Code|yes}}, {{Code|no}}| {{Code|yes}}| ''serialize''|- valign="top"| {{Code|indent}}| Indicates if whitespace should be added to the output with the aim of improving human legibility. If the parameter is set as in the query prolog, it overrides the {{Code|indent}} [[Serialization|serialization parameter]].| {{Code|yes}}, {{Code|no}}| {{Code|yes}}| ''serialize''|} The JSON function signatures provide an {{Code|$options}} argument. Options can either be specified* as children of an {{Code|<csv:options/>}} element; e.g.:<pre class="brush:xml"><csv:options> <csv:separator value=';'/> ...</csv:options></pre>* or as map, which contains all key/value pairs:<pre class="brush:xquery">{ 'separator': ';', ... }</pre>
=Functions=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu