Hello,
For me "json" serialization of XML (i.e. XML->JSON) is a false problem because you don't lose informations, so the format=json should always work. If you want to stay backward compatible, maybe a new value for the format parameter like format=djson for dirtyjson could be useful ?
I just realize that :
"Version 7.8
Removed: json:parse-ml, json:serialize-ml Updated: json:parse now returns a document node instead of an element, or an XQuery map if format is set to map.
Version 7.7.2
Updated: $options argument added to json:parse and json:serialize Updated: json:parse-ml and json:serialize-ml are now deprecated"
So BaseX 7.7.2 and the depreciated method=jsonml is just working fine and doing what I want.
http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho...
Really, why have you removed that ? Because there is the new options argument...it's more complex but ok if knew how to use it with REST API, please help me ^^ : http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho...
Cheers
Florent
Cheers
Florent
On 07/04/14 17:41, Florent Gallaire wrote:
Hello,
I'm new in the XML databases world, evaluating BaseX and eXist-db for a new project.
BaseX seems really clean and lightweight.
I would like to use it via the REST API and with a json output.
I test with the factbook.xml example database and the method parameter set to "json" : http://localhost:8984/rest/factbook?query=//city/name&wrap=yes works fine but http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho... returns [BXJS0002] JSON serializer: <json> expected as root node.
I don't understand why. I need json serialization whatever is the XML returned by the query.
And I don't understand how to use the json options via the REST API. http://docs.basex.org/wiki/JSON_Module An example could be fine to help.
Best regards
Florent
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- FLOSS Engineer & Lawyer
Really, why have you removed that ? Because there is the new options argument...it's more complex but ok if knew how to use it with REST API, please help me ^^ : http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho...
So I finally found how to do that via REST : http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho...
I'm not very happy with the syntax, which is more heavy than the old method=jsonml, and less clear (json=format=jsonml). But you can add other options like indent=no : http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho...
Maybe a shortcut method=jsonml could be back for simplicity ?
And add an example to the wiki ^^
Florent
Cheers
Florent
Cheers
Florent
On 07/04/14 17:41, Florent Gallaire wrote:
Hello,
I'm new in the XML databases world, evaluating BaseX and eXist-db for a new project.
BaseX seems really clean and lightweight.
I would like to use it via the REST API and with a json output.
I test with the factbook.xml example database and the method parameter set to "json" : http://localhost:8984/rest/factbook?query=//city/name&wrap=yes works fine but http://localhost:8984/rest/factbook?query=//city/name&wrap=yes&metho... returns [BXJS0002] JSON serializer: <json> expected as root node.
I don't understand why. I need json serialization whatever is the XML returned by the query.
And I don't understand how to use the json options via the REST API. http://docs.basex.org/wiki/JSON_Module An example could be fine to help.
Best regards
Florent
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- FLOSS Engineer & Lawyer
-- FLOSS Engineer & Lawyer
basex-talk@mailman.uni-konstanz.de