- Documentation
- Shared functions
- fromJSON
Function
fromJSON
Reads JSON text and returns a Lua value. A top-level array (the way toJSON writes) unpacks into several results. Broken JSON gives nil and a warning with the error position.
Syntax
mixed fromJSON(string json)Arguments
jsonstring- JSON text.
Returns
The decoded values or nil.
Example
local data = fromJSON('[{"money":500}]')
outputServerLog(data.money) -- 500