函数:json.decode json 串编码

函数名称:json 串编码

函数功能:将 json 格式数据转成 table 格式数据

函数方法

tb = json.decode(str)

参数 类型 必填 说明
str string 需要编码的 json 字符串
返回值 类型 说明
tb table 编码后的数据

函数用例

local json = require("json")
local my_table = {
    name = "John Doe",
    age = 30,
    hobbies = {"read", "game", "travel"}
}
local str = json.encode(my_table)
dialog(str,5000)
local tmp = json.decode(str)
dialog(tmp.name,5000)
Copyright 北京帮你玩科技有限公司 2024 all right reserved,powered by Gitbook该文章修订时间: 2025-04-28 17:09:24

results matching ""

    No results matching ""