Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

lua table to json

local personString = '{"name": "Squid", "job": "dev"}' -- A JSON string
-- If you need to turn the json into an object:
local personJSON = json.decode(personString)
-- Now you can use it like any table:
personJSON["name"] = "Illusion Squid"
personJSON.job = "Software Engineer"
-- If you have an object/table and want to make it a JSON string do this:
local newPersonString = json.encode(personJSON)
-- Simple!
 
PREVIOUS NEXT
Tagged: #lua #table #json
ADD COMMENT
Topic
Name
3+7 =