Hi there,
I have an issue with the migration of an XQuery script from eXist to Basex:
The link
https://gist.github.com/zopyx/467a01264d53bdaa48ad27cd553cfda8
shows the script and the expected (status quo) output for XML and JSON.
Calling the script using
/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