Hi Erol
I had exactly the same question some time ago.
As far as I know, BaseX does not have "native" JSON output supported. I was advised to use either some generic XSLT transformation, which converts XML into JSON, or use some Java library, which is supporting this and can be optionally called as imported function (I do not remembter which one, try searching archive or finding your own - there used to be some instruction how to use functions from jar archives as XQuery ones, but I have always problems finding this).
My real life project ended up with writting my own XQuery, generating text output. Any approach is making some assumptions and you easily find, that some parts of your system do not fit. My task was to generate json output, being usable for SIMILE framework and I had to follow the JSON structure, which SIMILE was expecting.
Good luck
Jan
2011/5/13 Erol Akarsu
<eakarsu@gmail.com>
Is there a way Basex server can send us JSON output instead of xml?