Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua_cjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static const char *char2escape[256] = {
"\\u0018", "\\u0019", "\\u001a", "\\u001b",
"\\u001c", "\\u001d", "\\u001e", "\\u001f",
NULL, NULL, "\\\"", NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, "\\/",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
Expand Down
1 change: 0 additions & 1 deletion manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ Lua CJSON will escape the following characters within each UTF-8 string:

- Control characters (ASCII 0 - 31)
- Double quote (ASCII 34)
- Forward slash (ASCII 47)
- Blackslash (ASCII 92)
- Delete (ASCII 127)

Expand Down
4 changes: 4 additions & 0 deletions tests/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ local cjson_tests = {
{ "Decode (safe) error generation after new()",
function(...) return json_safe.new().decode(...) end, { "Oops" },
true, { nil, "Expected value but found invalid token at character 1" } },

{ "Encode forward slash unescaped",
json.encode, {{ content={booths={custom0="https://t.co/a/b/c"}} }},
true, { '{"content":{"booths":{"custom0":"https://t.co/a/b/c"}}}' } },
}

print(("==> Testing Lua CJSON version %s\n"):format(json._VERSION))
Expand Down