Hi Jan, for the moment we do not offer any options to export the resulting file in JSON. However it could easily be added when using our API.
I found https://github.com/douglascrockford/JSON-java
which is a reference implementation according to http://www.json.org/java/ Converting serialized XML to JSON maybe adds another level of indirection but should suit most usecases well.
Hope this helps! In case it does not, feel free to ask for more.
Kind regards
Michael
Am 26.01.2011 um 20:47 schrieb Jan Vlčinský (CAD):
Hi I shall export JSON file based on XML structures I have in my XQuery. Here I found http://demo.exist-db.org/xquery/json-test.xql/source sample, how eXistDB can produce JSON data.
It is like
import module namespace json="http://www.json.org"; 04.
declare option exist:serialize "method=xhtml media-type=text/html";
let $xml1 := 08.
<root> 09. <h1>H</h1> 10. <p/> 11. <p>some text</p> 12. <h2>HH</h2> 13. </root>
<script type="text/javascript"> 43. var data1 = {json:xml-to-json($xml1)}; BaseX does not provide this and I wonder, what options I have and what would anyone recommend • building up plain text piece by piece by XQuery • using some Java lib for this (there are more, any practical experience welcome) • Some other trick, which lives hidden to me (I already queried BaseX wiki and no hit) Jan -- Ing. Jan Vlčinský CAD programy Slunečnicová 338/3, 734 01 Karviná Ráj, Czech Republic tel: +420-597 602 024; mob: +420-608 979 040 skype: janvlcinsky; GoogleTalk: jan.vlcinsky@gmail.com http://cz.linkedin.com/in/vlcinsky _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk