在go中使用lua示例, 基于gopher-lua!
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

14 řádky
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()")