diff --git a/lua_cjson.c b/lua_cjson.c index 22f33f1..75d5c69 100644 --- a/lua_cjson.c +++ b/lua_cjson.c @@ -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, diff --git a/manual.adoc b/manual.adoc index 83303a3..04c6bb8 100644 --- a/manual.adoc +++ b/manual.adoc @@ -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) diff --git a/tests/test.lua b/tests/test.lua index 9690db4..cbaa633 100755 --- a/tests/test.lua +++ b/tests/test.lua @@ -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))