json.parse
json.parse(jsonString)
Description
This function is utilized convert a JSON string to a Lua table.
Parameters
- jsonString – a string of data in JSON format
Return
Returns a table containing the information from the JSON string
Examples
-- Read the data from an existing text file containing json data from C:\myjsondata.json
-- Function will return a lua table containing the data
function ReadData()
local f = io.open("C:\\myjsondata.json", "rb")
if f then
return json.parse(f:read("*all"))
else
return nil
end
end