From: Nick S. <nsi...@nu...> - 2021-01-05 16:03:52
|
Eduard, I posted a similar question about the ordering of JSON after being converted from XML a while ago. The answer I received was that the JSON spec does not dictate that order of the data must be maintained. Perhaps there could be nested structure you could create to maintain the association of data elements? Nick On 1/5/21 4:37 AM, Eduard Drenth wrote: > Yes, something like: > > "text":{"match":"De","#text":[" volgende ","match":"dag"," zat Esther > in ","match":"de"," bibliotheek achter een stapel boeken over > psychiatrie en psychopathologie.\n "]} > > or (using badgerfish xslt): > > "text":[{"match":{"$":"De"}},{"$":" volgende > "},{"match":{"$":"dag"}},{"$":" zat Esther in > "},{"match":{"$":"de"}},{"$":" bibliotheek achter een stapel boeken > over psychiatrie en psychopathologie.\n "}] > > Important thing is the matches at the correct position. > > Bye, Eduard > > -----Original Message----- > *From*: Jean-Paul Rehr <re...@gm... > <mailto:Jean-Paul%20Rehr%20%3cr...@gm...%3e>> > *To*: Eduard Drenth <ed...@fr... > <mailto:Eduard%20Drenth%20%3ce...@fr...%3e>> > *Cc*: Exi...@li... > <Exi...@li... > <mailto:%22E...@li...%22%20%3cE...@li...%3e>> > *Subject*: Re: [Exist-open] json serialization > *Date*: Tue, 05 Jan 2021 10:39:44 +0100 > > Dear Eduard, can you provide an example of what you wish the json > output to look like? > > Best for the new year, > JPR > > On Tue, Jan 5, 2021 at 10:17 AM Eduard Drenth > <ed...@fr... <mailto:ed...@fr...>> wrote: >> Dear all, >> >> This xml snippet: >> >> <text> >> <match>De</match> >> volgende >> <match>dag</match> >> zat Esther in >> <match>de</match> >> bibliotheek achter een stapel boeken over psychiatrie en psychopathologie. >> </text> >> >> Is turned into the below json when using fn:serialize: >> >> >> >> As you can see, the match children are serialized first, which makes >> it impossible to get the matching right. >> >> The order of this serialization seems wrong, can this be configured / >> fixed? >> >> Regards, Eduard >> >> -- >> >> Eduard Drenth, Software Architekt >> >> ed...@fr... <mailto:ed...@fr...> >> >> Doelestrjitte 8 >> 8911 DX Ljouwert >> +31 58 234 30 47 >> +31 62 094 34 28 (privé) >> >> skype: eduarddrenth >> https://github.com/eduarddrenth <https://github.com/eduarddrenth> >> frisian.eu <http://frisian.eu> >> gpg: https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth >> <https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth> >> >> >> Op freed bin ik thús/wurkje ik minder >> >> >> >> _______________________________________________ >> Exist-open mailing list >> Exi...@li... >> <mailto:Exi...@li...> >> https://lists.sourceforge.net/lists/listinfo/exist-open >> <https://lists.sourceforge.net/lists/listinfo/exist-open> > -- > Eduard Drenth, Software Architekt > > ed...@fr... <mailto:ed...@fr...> > > Doelestrjitte 8 > 8911 DX Ljouwert > +31 58 234 30 47 > +31 62 094 34 28 (privé) > > skype: eduarddrenth > https://github.com/eduarddrenth <https://github.com/eduarddrenth> > frisian.eu > gpg: https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth > <https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth> > > > Op freed bin ik thús/wurkje ik minder > > > > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open -- Nick Sincaglia President/Founder NueMeta, LLC Digital Media & Technology Phone: +1-630-303-7035 nsi...@nu... http://www.nuemeta.com Skype: nsincaglia |