The result is XML-ish, try yourself:
curl -H"Accept:application/json" http://dev1.veit-schiele.de:8984/all-documents.json
My expectation is receiving a JSON string.
This is how the XQuery spec wants it to be. If you look closely, you will see that your result starts and end with double quotes.
The problem is that it's not possible to define a lossless bidirectional mapping for XML and JSON resources. In BaseX, one way out is to use the 'jsonml' serialization format [1,2]. It can be triggered by the following annotation:
%output:json("format=jsonml")
Using JSONML, you can serialize any XML document to JSON, but the result may not necessarily look like something JS developers are used to.
[1] http://docs.basex.org/wiki/JSON_Module#JsonML [2] http://www.jsonml.org/xml/