www.digitalmars.com         C & C++   DMDScript  

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


          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


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