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... [2] https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_JSON...
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:
1. true 2. ["a", "a", "a", "x"]
Kendall