www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15884] New: Assigning char[] to std.json.JSONValue creates

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

          Issue ID: 15884
           Summary: Assigning char[] to std.json.JSONValue creates array,
                    not string
           Product: D
           Version: D2
          Hardware: All
                OS: Mac OS X
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: lio+bugzilla lunesu.com

Repro:

void main(){
  import std.json;
  JSONValue v = "asdf".dup;
  assert(v.type == JSON_TYPE.STRING);//fails
  assert(v.toString == `"asdf"`);//also fails
}

Expected: the JSONValue should be created as a string
Actual: the JSONValue is an array and gets encodes as [97,115,100,102]

--
Apr 06 2016