在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

před 4 roky
  1. local json = require("json")
  2. local jsonStringWithNull = [[{"a":{"b":1, "c":null}}]]
  3. local jsonString = [[{"a":{"b":1}}]]
  4. local result, err = json.decode(jsonStringWithNull)
  5. if err then error(err) end
  6. if not(result["a"]["b"] == 1) then error("must be decode") end
  7. print("done: json.decode()")
  8. local result, err = json.encode(result)
  9. if err then error(err) end
  10. if not(result==jsonString) then error("must be encode "..result) end
  11. print("done: json.encode()")