Changes

Jump to navigation Jump to search
33 bytes added ,  02:11, 15 August 2011
==Examples==
'''Example 1: A basic example Adds all JSON documents in a directory to convert an empty a database''' '''Query:'''<pre class="brush:xquery">let $database := "database"for $name in file:list('.', false(), '*.json')let $file := file:read-text($name)let $json := json:parse($file)return db:add($database, document { $json }, $name) </pre> '''Example 2: Converts a simple JSON documentstring to XML'''
'''Query:'''
'''Result:'''
<pre class="brush:xml"><jsonobjects="json"/></pre>
'''Example 23: Conversion of some Converts a JSON string with simple objects and arrays'''
'''Query:'''
'''Result:'''
<pre class="brush:xml">
<jsonobjects="json">
<title>Talk On Travel Pool</title>
<link>http://www.flickr.com/groups/talkontravel/pool/</link>
</pre>
'''Example 34: Globally defined Converts a JSON string with different data types, key rewritings'''
'''Query:'''
</phone>
</json>
</pre>
 
'''Example 4: Adds all JSON documents in a directory to a database'''
 
'''Query:'''
<pre class="brush:xquery">
let $database := "database"
for $name in file:list('.', false(), '*.json')
let $file := file:read-text($name)
let $json := json:parse($file)
return db:add($database, document { $json }, $name)
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu