util.json: Fix encoding of json.null (bug introduced in bf1f09a5bcf7)
authorMatthew Wild <mwild1@gmail.com>
Fri, 4 Mar 2016 22:27:04 +0000 (22:27 +0000)
committerMatthew Wild <mwild1@gmail.com>
Fri, 4 Mar 2016 22:27:04 +0000 (22:27 +0000)
util/json.lua

index becd295d55590e4757736c8a9cc1b4c16e7d834f..2c598446bab233d05825b7926bd21a7bd29d7b19 100644 (file)
@@ -145,7 +145,9 @@ end
 
 function simplesave(o, buffer)
        local t = type(o);
-       if t == "number" then
+       if o == null then
+               t_insert(buffer, "null");
+       elseif t == "number" then
                t_insert(buffer, tostring(o));
        elseif t == "string" then
                stringsave(o, buffer);