在go中使用lua示例, 基于gopher-lua!
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

14 行
460 B

local json = require("json")
local jsonStringWithNull = [[{"a":{"b":1, "c":null}}]]
local jsonString = [[{"a":{"b":1}}]]
local result, err = json.decode(jsonStringWithNull)
if err then error(err) end
if not(result["a"]["b"] == 1) then error("must be decode") end
print("done: json.decode()")
local result, err = json.encode(result)
if err then error(err) end
if not(result==jsonString) then error("must be encode "..result) end
print("done: json.encode()")