On 01/07/2016 08:58, Mark Waddingham wrote:
1) Any JSON parser usable from LiveCode Script (right now) should just
return all values as strings - it should check they are well-formed as
per the JSON spec, but not actually attempt to convert or process them
as the engine is more than capable of doing that for you. (Except for
quoted values in JSON - they need to be 'unescaped').
This approach is pretty problematic from the point of view of the JSON
library extension shipped with the IDE. I originally wrote it for use
from LiveCode Builder, and as such it has to convert JSON values to
their "correct" LCB types in order to work usefully.
At the moment, the bridging rules from LiveCode Script to LCB types and
vice versa make the JSON library extension very nice to use from LCB and
reasonably usable from LCS.
To implement the scheme you describe above, the current JSON extension
would need to be split into three parts:
- An event-driven lexer/parser module that does no type conversion at
all but calls a set of callback handlers as it passes through the JSON
document
- A module for use from LCB that does LCB type conversion
- A library for use from LCS that doesn't do any type conversion at all
I can probably do that (and keep the API backward-compatible) but it
seems like a lot of work. :-)
Peter
--
Dr Peter Brett <peter.br...@livecode.com>
LiveCode Technical Project Manager
LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode