On 15 May 2014, at 8:47 pm, Pyyhtiä Christer <[email protected]> wrote:
> Just set itemDelimiter to "}” to extract the JSON elements, strip "{"
> -characters from those, look what you need to use as the next itemDelimiter
> and do it again. Then move to array.
>
> It probably takes less that 10 lines of code.
This may be overly simplistic. Using this approach, you would not be able to
appropriately parse things such as:
- JSON documents that have a array at the root instead of an object:
["some text", 3, { "key":"value"}]
- JSON documents that contain the "{" and "}" characters inside string values:
{ "key":"{3 + [ 4 x (1 + 1) + (5 x 2) ]}"}
- JSON documents that have objects nested inside objects:
{{ "key1": { "subKey1": "value"}},{ "key1": { "subKey1": "value"}}}
You will also come across other issues when you start dealing with JSON that
was generated by other encoders. For instance, PHP encodes unicode characters
in JSON strings using numerical hex codes that have to be converted into
"normal" string.
On 15 May 2014, at 8:47 pm, Pyyhtiä Christer <[email protected]> wrote:
> It is very easy with pure LiveCode. [...]
>
> This is the way I have done it and don't need any externals.
Indeed!
Note, that EasyJSON is NOT an external - it is a pure LiveCode script that you
can include in your own stacks, or use with LiveCode Server.
--
Igor Couto
Sydney, Australia
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode