[Issue 15884] New: Assigning char[] to std.json.JSONValue creates array, not string

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 6 03:56:37 PDT 2016


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 at puremagic.com
          Reporter: lio+bugzilla at 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]

--


More information about the Digitalmars-d-bugs mailing list