www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15510] New: json shouldn't escape forward slash by default


          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 puremagic.com
          Reporter: timothee.cour2 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.

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.

Jan 03 2016