Changes

Jump to navigation Jump to search
744 bytes added ,  16:51, 26 October 2017
["phone", {"type":"home"},
"212 555-1234"]]
</pre>
 
==XQuery Format==
 
'''Example 1: Converts a JSON string to XQuery'''
 
'''Query:'''
<pre class="brush:xquery">
let $input := '{
"Title": "Drinks",
"Author": [ "Jim Daniels", "Jack Beam" ]
}'
let $data := json:parse($input, map { 'format': 'xquery' })
return map:for-each($data, function($k, $v) {
$k || ': ' || string-join($v, ', ')
})
</pre>
 
'''Result:'''
<pre>
Author: Jim Daniels, Jack Beam
Title: Drinks
</pre>
 
'''Example 2: Converts XQuery data to JSON'''
 
'''Query:'''
<pre class="brush:xquery">
for $item in (
true(),
'ABC',
array { 1 to 5 },
map { "Key": "Value" }
)
return json:serialize(
$item,
map { 'format': 'xquery', 'indent': 'no' }
)
</pre>
 
'''Result:'''
<pre>
true
"ABC"
[1,2,3,4,5]
{"Key":"Value"}
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu