Hi Andreas, Once again I must confess that I don’t know enough about eXist-db. What I can say is that only some JSON features were standardized, and not necessarily the ones that you find in eXist-db, BaseX and other processors (which were implemented much earlier). I have just referenced some of our JSON features in another mail some minutes ago [1,2]. They might give you an impression what is possible with BaseX, and how it differs from eXist-db.
Or how can I generate a JSON result that is compatible with the existing JSON response from eXist-dB?
It may be best to export the eXist-db documents as JSON and reimport back (i.e., convert them to our JSON XML representation) in BaseX. Out of interest: Is the eXist-db JSON format fully bidirectional? If yes, we could think about adding the conversion rules to the next version of BaseX. Best, Christian [1] http://docs.basex.org/wiki/XQuery_3.1#JSON_Functions [2] http://docs.basex.org/wiki/Json_Module
/rest/foo/?run=foo.xql&method=json
generates an HTTP response with
Content-Type: application/json;charset=utf-8
but the output is a quoted XML string like:
"<item><uri>\/foo\/de\/ayapedia\/addendums\/ernaehrung_9861fc6a-ba68-11e8-a8a1-001c4210b7a0\/current-20180920-111838.bak\/xml\/index.xml<\/uri><title>Ernährung<\/title><description\/><language>de<\/language><status>current<\/status><area>ayapedia<\/area><path\/><date>2018-09<\/date><url\/><atc_code\/><guideline_id>bef53078-2d8d-42d1-af8c-b3d387dfa52e<\/guideline_id><plone_uuid>464520ec154a42839b9f5d2635caccaf<\/plone_uuid><old_authors_additional\/><authors_additional>für den Arbeitskreis Ernährung, Stoffwechsel und Bewegung der DGHO<\/authors_additional><documenttype>ayapedia<\/documenttype><societies xmlns:json=\"http:\/\/basex.org\/modules\/json\" json:array=\"true\">dgho<\/societies><guideline_topics xmlns:json=\"http:\/\/basex.org\/modules\/json\" json:array=\"true\">183<\/guideline_topics><authors xmlns:json=\"http:\/\/basex.org\/modules\/json\" json:array=\"true\">9211<\/authors><authors xmlns:json=\"http:\/\/basex.org\/modules\/json\" json:array=\"true\">5577<\/authors><authors xmlns:json=\"http:\/\/basex.org\/modules\/json\" json:array=\"true\">13728<\/authors><authors xmlns:json=\"http:\/\/basex.org\/modules\/json\" json:array=\"true\">373215<\/authors><\/item>"
Calling
/rest/foo/?run=foo.xql&method=json&json=format=jsonml"
finally generates JSON but not in the related format.
Isn't the JSON serialization supposed being standardized and compatible? Or how can I generate a JSON result that is compatible with the existing JSON response from eXist-dB?
Andreas