json and restxq

Monday, 22 July 2013 · 2 messages
JM
Jean-philippe Magué22 Jul 2013 16:25 #
Hello again, As we were testing the version 7.7, we ran into a problem (that actually existed in 7.6 too). We cannot produce json with restxq. We came up with a minimal file that illustrate the problem: ------- module namespace local = 'http://www.example.com/local'; declare %restxq:path("") %output:method("json") function local:test-json() { '{}' }; ------- This produce the following error : HTTP ERROR 400 Problem accessing /. Reason: [BXJS0002] JSON serialization: Atomic values cannot be serialized. Are we missing something ? Best, Jean-Philippe
-- Jean-Philippe Magué Maître de Conférences en Humanités Numériques Responsable de l'Atelier des Humanités Numériques : ahn.ens-lyon.fr Ecole Normale Supérieure de Lyon +33 (0)4 26 23 38 08 -- "Using computers will therefore lead us to a more profound and systematic knowledge of human expression; in principle, it can help us to be more humanistic than before." Busa, 1980.
DK
Dirk Kirsten22 Jul 2013 16:40 #
Hello Jean-Philippe, As the error statement indicates, the serializer can not serialize atomic values such as this string. Please take a look at the following part of the documentation, which describes the format to serialize to JSON: http://docs.basex.org/wiki/JSON#JSON_Functions So for example you will need an <json /> root node. As an atomic value does not have this root node we can not serialize it. Cheers, Dirk
Quoted text · Jean-philippe Magué · 49 lines
On 07/22/2013 04:25 PM, Jean-philippe Magué wrote: > Hello again, > > As we were testing the version 7.7, we ran into a problem (that > actually existed in 7.6 too). We cannot produce json with restxq. We > came up with a minimal file that illustrate the problem: > > > ------- > module namespace local = 'http://www.example.com/local'; > > declare %restxq:path("") > %output:method("json") > function local:test-json() { > '{}' > }; > ------- > > This produce the following error : > > HTTP ERROR 400 > Problem accessing /. Reason: > [BXJS0002] JSON serialization: Atomic values cannot be serialized. > > > Are we missing something ? > > Best, > > Jean-Philippe > > -- > Jean-Philippe Magué > Maître de Conférences en Humanités Numériques > Responsable de l'Atelier des Humanités Numériques : ahn.ens-lyon.fr > Ecole Normale Supérieure de Lyon > +33 (0)4 26 23 38 08 > > -- > > "Using computers will therefore lead us to a more profound and > systematic knowledge of human expression; in principle, it can help us > to be more humanistic than before." > Busa, 1980. > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
-- 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

⚡Generated with XQuery