Thank you Rick. This is a solution I came up with. It's similar to yours. It puts a JSON string into a Lua table:
--Load JSON (http://regex.info/blog/lua/json) library
JSON = (loadfile "lua/JSON.lua")() -- put the lib in "lua" folder
path = "pathToJSON"
stream = FileSystem:OpenFile(path)
jsonString = ""
if (stream) then
while (not stream:EOF()) do
jsonString = jsonString .. stream:ReadString()
end
data = JSON:decode(Swinglets.jsonString)
else
System:Print("Stream not found")
end
Can you tell me why i get the following error:
"attempt to index a nil value (global 'FileSystems')"
and also in the path variable i have to initialize the path of the json that i want to parse right ?
Read a JSON file into a Lua string / table
in Programming
Posted
Can you tell me why i get the following error:
"attempt to index a nil value (global 'FileSystems')"
and also in the path variable i have to initialize the path of the json that i want to parse right ?
Thank you !