JSON
The static global JSON class provides the ability to encode/decode data into JSON strings. This is largely used by the onSave() event function, but has other potential applications as well. The JSON class can be used on any String, Int, Float or Table. You call these functions like this: JSON.encode(...)
.
Warning
This class does not work with Object references. Use the Object's GUID instead.
Function Summary¶
Function Details¶
decode(...)¶
Value obtained from the encoded string. Can return a number, string or Table.
decode(json_string)
coded = JSON.encode("Test")
print(coded) --Prints "Test"
decoded = JSON.decode(coded)
print(decoded) --Prints Test
encode(...)¶
Encodes data from a number, string or Table into a JSON string.
encode_pretty(...)¶
Encodes data from a number, string or Table into a JSON string. This version is slightly less efficient but is easier to read.