On 12/1/20 1:38 PM, Harald Oehlmann wrote:
Am 01.12.2020 um 12:21 schrieb Massimo Manghi:
I've been extensively using FA's yajltcl package lately to compose
JSON messages to be consumed and interpreted by a browser internal parser
I also ran into the need of parsing JSON messages myself and from what
I understood yajltcl converts JSON back to the original yajltcl
sequence that created it but offers no way to organize the data into
some Tcl native container, is it correct? A parser that converts the
yajltcl representation of the JSON data in some Tcl native
representation is something needed to yajltcl?
Dear Massimo,
thank you for the message. I suppose, this would be good work.
May I point your attention to tdom which is now able to parse and
construct JSON in a similar manner as XML. In addition, you get the
additional fruit, that you may choose the output format the last moment
(JSON or XML).
I have not tried this but it might be a strategic thought.
Thank you,
Harald
Thank you Harald,
I had tdom at work for years in most of my Rivet projects and I became
accustomed to the fact that it was pretty stable but had little
development, event though a version 1.0.0 is still due. I missed the
JSON support. I ought to follow more closely the release of new stuff......
nonetheless I fiddled around with yajltcl and wrote a simple Tcl parser
of the yajltcl dom representation. For the test cases I could figure out
the parser produces a Tcl dictionary. The pitfall of a dictionary is
that in order to read the data correctly you need to know beforehand
what is the dom structure stored in the dictionary, but this is often
the case when exchanging specific application messages. I guess that
creating a struct::tree representation to remove ambiguities would be
straightforward
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]