====Serialization====
{{Mark|Warning}}: BaseX has been using the {{Code|json}} output method for a while. With BaseX 8.0, the implementation of this method will be has been rewritten to comply with the new standard serialization rulesand, at the same time, to preserve the existing semantics: * If an XML node of type {{Code|element(json)}} is found, it will be serialized following the serialization rules of the [[JSON Module]]. We * Any other node or atomic value, map, array, or empty sequence will do our best be serialized according to keep the updated code backward[http://www.w3.org/TR/xslt-xquery-serialization-compatible31/ Official Specification]. The following two queries will return the JSON snippet <code>{ "key": "value" }</code>:
<pre class="brush:xquery">
(: will return { "key": "value" } :)
declare option output:method 'json';
map { "key": "value" }
</pre>
<pre class="brush:xquery">
declare option output:method 'json';
<json type='object'>
<key>value</key>
</json>
</pre>