Hello Dirk,
Thank for your answer, but "direct" and "attribute" format are not easy to use, I could even say that they are too hard to use for normal people.
And they need a lot of extra work: <json> root node, _ elements, etc. I just would like an easy way, with no extra work to process arbitrary XML.
An easy use like the jsonml option, but with an useful output.
Cheers
Florent
On Mon, Jan 5, 2015 at 8:38 AM, Dirk Kirsten dk@basex.org wrote:
Hello Florent,
JsonML isn't the only way to generate JSON with BaseX; it isn't even the default one. Please take a look at our documentation at http://docs.basex.org/wiki/JSON to see what is available. We agree that JsonML isn't the most convenient format, that's why the BaseX-specific direct format is the default one.
Cheers, Dirk
On 01/05/2015 05:46 AM, Florent Gallaire wrote:
Whether my database this XML file:
<?xml version="1.0" encoding="UTF-8"?>
<mots> <mot> <nom>iatrogène</nom> <racine>gène</racine> </mot> <mot> <nom>hippiatre</nom> <racine>hippo</racine> </mot> </mots>
The only easy way to have JSON serialization with BaseX is to use the "format=jsonml" option which returns: ["mots", ["mot", ["nom", "iatrogène"], ["racine", "gène"]], ["mot", ["nom", "hippiatre"], ["racine", "hippo"]]]
This output is not at all what I need, and think I'm not the only one in this case. A quick search on Google give us simple online tools which have an useful output:
http://codebeautify.org/xmltojson { "mots": { "mot": [ { "nom": "iatrogène", "racine": "gène" }, { "nom": "hippiatre", "racine": "hippo" } ] } }
http://www.utilities-online.info/xmltojson { "mots": { "mot": [ { "nom": "iatrogène", "racine": "gène" }, { "nom": "hippiatre", "racine": "hippo" } ] } }
Could we have this "easyjson" option in BaseX ? I know that it has not at all the power of lossless conversion from JSON to XML and back, like the "direct" and "attributes" options, but who really cares ?
I really think it's what most users need today to use BaseX with client side JSON oriented frameworks.
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