函数:ts.json.decode json 串编码

函数名称:json 串编码

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

函数方法

tb = json.decode(str)

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

函数用例

local ts = require("ts")--使用扩展库前必须插入这一句
local json = ts.json--使用 JSON 模块前必须插入这一句
local str = [[{"meme":[1,0,0,4,6,9,5,1,0,0],"我":"五毛","爱":"六块"}]]
--把 json 字符串转换成 table
local tmp = json.decode(str)
dialog(tmp.meme[5],5);
dialog(tostring(tmp.nullvalue),5);
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""