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