More JSON handling fixes

master
Aaron Suen 2021-09-10 08:23:22 -04:00
parent 0cbcea29dd
commit 13b2802cb9
1 changed files with 4 additions and 1 deletions

View File

@ -37,9 +37,12 @@ ser["number"] = function(x)
end
ser["boolean"] = ser["number"]
ser["string"] = function(x)
return string_gsub(string_format("%q", x), "%c", function(c)
x = string_format("%q", x)
x = string_gsub(x, "\n", "n")
x = string_gsub(x, "%c", function(c)
return "\\00" .. string_format("%02x", string_byte(c))
end)
return x
end
ser["table"] = function(x)
local arr = {}