在go中使用lua示例, 基于gopher-lua!
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

14 satır
460 B

4 yıl önce
  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()")