Changes

Jump to navigation Jump to search
1,088 bytes added ,  20:45, 23 October 2014
no edit summary
Please check out the [[Array Module]] for more details.
 
===JSON Functions===
 
====fn:parse-json====
 
; Signatures
* <code>fn:parse-json($input as xs:string) as item()?</code>
* <code>fn:parse-json($input as xs:string, $options as map(*)) as item()?</code>
 
Parses the supplied string as JSON text and returns its item representation. The result may be a map, an array, a string, a double, a boolean, or an empty sequence. The allowed options are further specified in the [http://www.w3.org/TR/xpath-functions-31/#func-parse-json specification].
 
<pre class="brush:xquery">
map:serialize(parse-json('{ "name": "john" }')) (: yields { "name": "json" } :),
parse-json('[ 1, 2, 4, 8, 16]')?* (: yields the integer sequence 1, 2, 4, 8, 16 :),
</pre>
 
====fn:json-docs====
 
; Signatures
* <code>fn:json-doc($uri as xs:string) as item()?</code>
* <code>fn:json-doc($uri as xs:string, $options as map(*)) as item()?</code>
 
Retrieves the text from the specified URI, parses the supplied string as JSON text and returns its item representation (see [[#fn:parse-json|fn:parse-json]] for more details).
 
<pre class="brush:xquery">
json-doc("http://ip.jsontest.com/")('ip') (: returns your IP address :)
</pre>
===fn:sort===
The features of XQuery 3.1 are still subject to change, but we are planning to add the following enhancements in near future:
* Support for JSON: <code>fn:json-doc</code>, <code>fn:parse-json</code>
* New functions: <code>fn:collation-key</code>, <code>fn:load-xquery-module</code>, <code>fn:transform</code>, <code>fn:random-number-generator</code>
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu