On Thu, 28 Feb 2019, Sven Schreiber wrote:
Am 28.02.2019 um 19:03 schrieb Allin Cottrell:
> On Thu, 28 Feb 2019, Sven Schreiber wrote:
>> I'm still talking about stuff I don't fully understand, but maybe we
>> should have a hansl function that writes out the contents of a bundle (or
>> let's say, a well-defined subset of possible contents) as a json string or
>> file.
>
> bwrite() already serializes a bundle as XML. Is there a substantial
> advantage in having a JSON serialization too? If so, is that best done by
> writing a new serialization, or by transcoding the XML? (Googling "convert
> XML to JSON" shows up tons of transcoding options.)
Artur can perhaps give a better answer, but my impression with xml is that it
is too generic. You can do a lot of stuff with it, but in the end that
requires to have some clever xslt or similar thing which for me basically
means the same amount of work as simply exporting it in the desired format in
the first place.
So what's the use of a gretl bundle written out in xml from, say, Python's
point of view? Well, given the nice xml tools for Python I can imagine it's
not too difficult to get a tailor-made solution to grab the matrices in
there. So yes, maybe the json thing isn't needed.
Interesting ideas all round, but before pursuing them it would seem
to be worth figuring out: What are the actual targets? (That is, the
other software to which we'd like to be able to pass gretl bundles.)
And what can they (best) parse? Can they happily read JSON but not
XML, or vice versa?
For target languages without such tools my first impression is
that reading and processing json is simpler.
The relevant tools are readily available in the free software domain
(e.g. libxml2 and json-glib). But if target software S is "without
such tools" (i.e. doesn't link to such libraries and expose their
functionality natively, as with gretl's jsonget and xmlget) it would
probably be a rather massive job to implement them in S's language.
IMO, S would have to offer some very special value-added to make
this worthwhile.
Allin