Initial release of a JSON module

Notices and updates
Locked
Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Initial release of a JSON module

Post by Lutz »

The initial release of a JSON module can be found here:

http://www.newlisp.org/modules/various/json.lsp.html

also linked from the "Various" section on the main modules index:

http://www.newlisp.org/modules/

The module is based on the JSON code from the Tips&Tricks section but with the missing true,false and null -keywords added. The code is also a typical example how to write parsers and code translators in newLISP.

itistoday
Posts: 429
Joined: Sun Dec 02, 2007 5:10 pm
Contact:

Re: Initial release of a JSON module

Post by itistoday »

Cool! Are you planning to update it with an 'expr2json'? That would be quite handy...
Get your Objective newLISP groove on.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Initial release of a JSON module

Post by Lutz »

Currently in 'json2expr', sequences and arrays, both are translated into normal lists, which for practical purposes in most real world cases is good enough. But for large JSON arrays of e.g. thousands of elements, a translation of JSON arrays into newLISP arrays would be superior, and would not create the ambiguity when back translating wirth the future 'expr2json'.

The next version 0.2 will introduce a 'true' flag as in (json2expr json-text true) and will translate JSON arrays into newLISP arrays when the flag is present, then a back-translation with 'expr2json' doesn't have the ambiguity problem. The 'expr2json' function could carry the same flag.

Most people (including I) use newLISP arrays rarely, so the current simple way of doing it seems adequate as a start.

Locked