Now available! LiveCode Create DP-2 for Cloud, Native and Universal.
We’ve been working hard cleaning up code, fixing bugs and making the Create experience better. We also have one, much requested, addition for you: faithful & fast JSON.
Encoding of values is substantially better than any other existing LiveCode JSON encoding solution. The functions use lower-level type information to determine what kind of JSON value to generate. and numbers are encoded using the ECMAScript rules meaning that they will be emitted the same as they are when encoding as JSON from JavaScript.
Decoding of values is similarly substantially better than any other existing LiveCode JSON decoding solution. JSON values are decoded to LiveCode values tagged with lower-level type information.
The main outcome of this that LiveCode values will ’roundtrip’ through JSON identically. In particular, values such as [] and {} will encode to and from [] and {}, and it is possible to distinguish between [1,2] and {“1″:1,”2”:2}.
Finally, the performance of the new functions is substantially better than any currently existing alternative.
Performing a simple benchmark on a 25Mb JSON file (on an Intel mac) containing a mixture of numbers, strings (both unicode and ascii), arrays and objects to several levels of nesting results in the following:
Implementation
jsonEncode/jsonDecode
Engine
0.14s
0.75s
ArrayToJSON/ArrayFromJSON
mergJSON
4.8s
5.1s
JsonExport/JsonImport*
JSON Library
25.5s
189s
JSONStringify/JSONParser
PhotonJSON
2.7s
6.7s
Python3
built-in
0.22s
0.25s
Node (JavaScript)
built-in
0.1s
0.19s