JSON Javascript library

Warning:
This tutorial covers only Mobile Widgets versions.
Tiny Widgets don't support JSON.

Load and parse JSON data.

int open (String buffer, int mode):
Create a JSON DOM by parsing the provided buffer or url according to mode.
The value returned must be used for all subsequent operations on this DOM.

void close (int id):
Destroy the DOM and release any resources associated to id.

bool find (int id, String path):
Set a pointer to an element defined by the path.
The form of this path is nodeName1/nodeName2/...
If the value of the node is an array and not an Object, then the form index can be used instead.
Example: main/table*1/key points to the key element that is stored at the second position inside the array associated to table, child of main, like in:

This obviously implies that the structure is known in advance!

int/String getValue (int id):
Returns the value located to the previous find command.
This will return 0 for types other that string, number and constants (true, false and null).
In the previous example, returns the number 2.

int getType (int id):
Returns the type of the value located to the previous find command.
In the previous example, returns JSON.NUMBER.

int getSize (int id):
Returns the size of the value located to the previous find command.
Returns always 1 except for arrays.


NUMBER, STRING, OBJECT, ARRAY, TRUE, FALSE, NULL, ERROR:
Types returned by the JSON.getType () method.

BUFFER, URL, KEEP_ALIVE, DEBUG, ASYNC:
Values that can be used for the mode argument of the JSON.open() method.