Changes

Jump to navigation Jump to search
323 bytes added ,  11:16, 18 October 2013
no edit summary
This [[Module Library|XQuery Module]] contains functions to parse and serialize JSON documents. [http://www.json.org/ JSON (JavaScript Object Notation)] is a popular data exchange format for applications written in JavaScript. As there are notable differences between JSON and XML, no mapping exists that guarantees a lossless, bidirectional conversion between JSON and XML. For this reason, we offer two sets various mappings, all of functions in this module:which are suited to different use cases.
=Conventions=
All errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.
=Formats=Rules==
==BaseX==The JSON conversion rules have been updated with {{Version|7.8}}:
===Direct Conversion=== The standard BaseX JSON {{Code|direct}} conversion format facilitates allows a lossless conversion from JSON to XML and back. The transformation is based on the following rules: # The resulting document has a {{Code|<json/>}} root node.
# Names (keys) of objects are represented as elements:
## Empty names are represented by a single underscore ({{Code|&lt;_&gt;...&lt;/_&gt;}}).## Underscore characters , existing underscores are rewritten to two underscores ({{Code|__}}).## A character and characters that cannot be represented as NCName character is are not valid in element names are rewritten to an underscore and its the character’s four-digit Unicode.## If the {{Code|lax}} option is set to {{Code|false}}, invalid characters are replaced with undercscores. The resulting names are better readable, but cannot always be losslessly converted back to JSON.
# As the members of arrays have no names, {{Code|&lt;value/&gt;}} is used as element name.
# JSON values are represented as text nodes.
## The ''string'' type is omitted, as it is treated as default type.
## 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 the plural (''numbers'', ''booleans'', ''nulls'', ''objects'' and ''arrays''), and the attribute value contains all names with that type, separated by whitespaces.
 
===Attributes Conversion===
 
==JsonML==
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu