Skip to content

Commit

Permalink
Fixed decoding of escaped '/', added test
Browse files Browse the repository at this point in the history
  • Loading branch information
rxi committed Aug 31, 2015
1 parent 45cd518 commit 4fb28bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local escape_char_map = {
[ "\t" ] = "\\t",
}

local escape_char_map_inv = {}
local escape_char_map_inv = { [ "\\/" ] = "/" }
for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k
end
Expand Down
1 change: 1 addition & 0 deletions test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ test("decode escape", function()
[ [["\r\n\t\\\""]] ] = '\r\n\t\\"',
[ [["\\"]] ] = '\\',
[ [["\\\\"]] ] = '\\\\',
[ [["\/"]] ] = '/',
}
for k, v in pairs(t) do
local res = json.decode(k)
Expand Down

0 comments on commit 4fb28bb

Please sign in to comment.