Bug 11527 – JSONValue cannot set values through named fields
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-16T02:31:00Z
Last change time
2013-11-20T09:50:43Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2013-11-16T02:31:46Z
Following test cases will throw JSONException in runtime:
import std.json;
void main()
{
JSONValue v;
v.integer = 1;
}
Output:
std.json.JSONException@std\json.d(91): JSONValue is not an integer
This is caused by:
https://github.com/D-Programming-Language/phobos/pull/1421
Comment #3 by john.loughran.colvin — 2013-11-16T04:43:18Z
I thought this was by design as part of the new API? One of the goals was to add type-safety.
auto v = JSONValue(1);
and
JSONValue v;
v.type = JSON_TYPE.INTEGER;
v.integer = 1;
are both valid.
Comment #4 by github-bugzilla — 2013-11-20T09:50:30Z