[Issue 15510] New: json shouldn't escape forward slash by default

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jan 3 20:39:03 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15510

          Issue ID: 15510
           Summary: json shouldn't escape forward slash by default
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: timothee.cour2 at gmail.com

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-escaped
https://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.

--


More information about the Digitalmars-d-bugs mailing list