Christian,
Can you give an example of how to convert JSON data to atomic XQuery items (sepecifically strings, numbers and booleans)? Is it as simple as removing the curly brackets to bound an object?
On Wed, Nov 15, 2017 at 11:05 AM, Kendall Shaw kendall.shaw@workday.com wrote:
On 11/15/17, 4:24 AM, "basex-talk-bounces@mailman.uni-konstanz.de on behalf of Christian Grün" <basex-talk-bounces@mailman.uni-konstanz.de on behalf of christian.gruen@gmail.com> wrote:
Hi Maurice, Depending on the chosen format, different outputs will be generated by json:parse. Traditionally, it is true that only XML was generated by this function, but in newer versions (and in alignment with the XQuery 3.1 specs and the fn:parse-json function), it is also possible now to convert JSON data to atomic XQuery items (maps, arrays, strings, numbers and booleans) [1,2]. The resulting representation will be more memory-efficient, and access to XQuery maps is blazing fast, but it won’t be possible to store this representation to a database. Hope this helps, greetings, Christian [1] https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.
basex.org_wiki_JSON-5FModule-23XQuery&d=DwIFaQ&c=DS6PUFBBr_ KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq- Up2QMq9rrGyfWK0KtSpT7dxRglA&m=gYEI_kXgIHiAXP9cz0NdqkWgkjfpAGxnOd1 -b8pW3mo&s=_ugHBUSWLu-V4vzcR6jpfcc11M-g6zbiag5lU7COcLA&e= [2] https://urldefense.proofpoint.com/v2/url?u=http-3A__docs. basex.org_wiki_JSON-5FModule-23XQuery-5FFormat&d=DwIFaQ&c=DS6PUFBBr_ KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq- Up2QMq9rrGyfWK0KtSpT7dxRglA&m=gYEI_kXgIHiAXP9cz0NdqkWgkjfpAGxnOd1 -b8pW3mo&s=o-pnuPNeYd74pBg0DLEEtwO3r4IKsaC7DPGIo7gxG6c&e=
On Wed, Nov 15, 2017 at 8:30 AM, <m.vankeulen@utwente.nl> wrote: > Christian, > > The JSON Module suggests that JSON objects are represented as
XML-documents > with a certain structure, not as immutable maps. Is there support in BaseX > for json:parse and json:serialize for parsing JSON in textual form into > immutable maps and back to JSON in textual form? > > Kind regards, > Maurice van Keulen
Aside from XQuery and BaseX converting JSON, because JSON is not just objects, I think there could be a problem with the concept of converting JSON to maps, also. For example, these JSON documents aren’t map-like:
- true
- ["a", "a", "a", "x"]
Kendall