Răsfoiți Sursa

update: 完善一下demo/json对json.null和64bit的处理演示

Wendal Chen 2 ani în urmă
părinte
comite
a347195e5f
1 a modificat fișierele cu 10 adăugiri și 0 ștergeri
  1. 10 0
      demo/json/main.lua

+ 10 - 0
demo/json/main.lua

@@ -49,6 +49,16 @@ sys.taskInit(function()
         local tmp3 = json.decode(tmp2)
         local tmp3 = json.decode(tmp2)
         log.info("json", "tmp3", tmp3.str, tmp3.str == tmp)
         log.info("json", "tmp3", tmp3.str, tmp3.str == tmp)
         -- break
         -- break
+
+        log.info("json.null", json.encode({name=json.null}))
+        log.info("json.null", json.decode("{\"abc\":null}").abc == json.null)
+        log.info("json.null", json.decode("{\"abc\":null}").abc == nil)
+
+        -- 以下代码仅64bit固件可正确运行
+        local tmp = [[{ "timestamp": 1691998307973}]]
+        local abc, err = json.decode(tmp)
+        log.info("json", abc, err)
+        log.info("json", abc and abc.timestamp)
     end
     end
 end)
 end)