📜  lua 表到 json - Lua 代码示例

📅  最后修改于: 2022-03-11 14:54:55.777000             🧑  作者: Mango

代码示例1
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!