any fromJSON(string json)
Parameters
| Name | Type | Description |
|---|---|---|
| json | string | The JSON text. |
Returns
The value read. If the text is not valid JSON, nil and a message saying what is wrong and where.
Objects and arrays become tables, and null becomes nil (in an array, it leaves a hole). Whole numbers become Lua integers. Over 32 levels of nesting are refused.
Example
local data, problem = fromJSON('{"name":"Carl","money":350}')
if problem then
outputDebugString("Bad JSON: " .. problem, 2)
else
print(data.name, data.money)
end