Cjson.Decode json转table
🎯功能
json数据转换table。
📜语法
结果 = Cjson.Decode(json文本)
📥参数
参数 | 数据类型 | 解释 |
---|---|---|
json文本 | 字符串 | 待转换的json文本内容。 |
📤返回
表
,返回json对应的table。
💡示例
Import "Cjson.lua"
Import "zm.luae"
Dim json, table
json = "{""name"":""紫猫"",""联系"":{""QQ"":[3,4,5,9,1,1,2,2,0]},""url"":""m.zimaoxy.com""}"
// json数据转换table
table = Cjson.Decode(json)
// 输出table内容
TracePrint zm.VarInfo(table)
// table数据转换json
json = Cjson.Encode(table)
// 输出json内容
TracePrint json
📘备注
例子中的zm插件请前往 zm.About 介绍与下载 下载。