Comment #0 by timothee.cour2 — 2016-01-04T04:39:03Z
void main(){
import std.json;
JSONValue v = [ "file": "a/b"];
auto v2=v.toString;
assert(v2==`{"file":"a\/b"}`, v2);
}
It would be nice to have an option (which should be default IMO) to not escape forward slashes.
context:
http://stackoverflow.com/questions/1580647/json-why-are-forward-slashes-escapedhttps://github.com/esnme/ultrajson/issues/110
QUOTE: The JSON spec says that forward slashes may be escaped or not escaped. Unless there is a compelling reason to escape them it would be preferable to follow the behavior of Python's json module and not escape them.
Comment #1 by andre — 2016-03-17T19:16:38Z
Everywhere I use toString method I also add the replace(`\/`,`/`) because for my use cases the \/ escaping is just wrong.
I am not sure whether the default behavior should be changed because this could silently introduce new behaviors in existing programs but there should be definitely a new option "noForwardSlashEncoding" in JSONOptions.