diff --git a/json_object.c b/json_object.c index 076cf45..95af40a 100644 --- a/json_object.c +++ b/json_object.c @@ -136,7 +136,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, int len, int fl else if(c == '\f') printbuf_memappend(pb, "\\f", 2); else if(c == '"') printbuf_memappend(pb, "\\\"", 2); else if(c == '\\') printbuf_memappend(pb, "\\\\", 2); - else if(c == '/') printbuf_memappend(pb, "\\/", 2); + else if(c == '/') printbuf_memappend(pb, "/", 1); start_offset = ++pos; break; diff --git a/tests/test_parse.c b/tests/test_parse.c index 73487b6..263f0b6 100644 --- a/tests/test_parse.c +++ b/tests/test_parse.c @@ -309,7 +309,7 @@ struct incremental_step { { "\"\\n\"", -1, -1, json_tokener_success, 0 }, { "\"\\r\"", -1, -1, json_tokener_success, 0 }, { "\"\\t\"", -1, -1, json_tokener_success, 0 }, - { "\"\\/\"", -1, -1, json_tokener_success, 0 }, + { "\"/\"", -1, -1, json_tokener_success, 0 }, // Escaping a forward slash is optional { "\"/\"", -1, -1, json_tokener_success, 0 },