json json数据解析
2022-12-22 14:27:16 最后更新
用法:
//解析json数据
s text = "{"id":1, "name":"xiaobai", "age":16}"
json(text, jo)
//获取id
json(jo, "get", "id", a)
syso(a)
//获取name
json(jo, "get", "name", b)
syso(b)
//获取age
json(jo, "get", "age", c)
syso(c)

//修改age数据
json(jo, "set", "age", 20)

//删除id数据
json(jo, "del", "id")

//打印json数据
json(jo, "json", text)
syso(text)

//解析json列表数据
s text = "{"userlist":[{"id":1, "name":"niubi", "age":16},{"id":2, "name":"wangba", "age":18},{"id":3, "name":"goudan", "age":17}]}"
json(text, jo)

//打印json数据
json(jo, "list", "userlist", list)
json(list, "size", size)
w(size > 0)
{
s-(1, size)
json(list, "data", size, item)

//获取id
json(item, "get", "id", a)
syso(a)
//获取name
json(item, "get", "name", b)
syso(b)
//获取age
json(item, "get", "age", c)
syso(c)

}

说明:
常用于解析服务器反馈的数据。