[Issue 23393] New: JSONValue: Appending object to array fails
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 7 08:38:56 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23393
Issue ID: 23393
Summary: JSONValue: Appending object to array fails
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
Consider this code:
```
JSONValue test = parseJSON(`{"a": [{"b": 5}]}`);
test["a"] ~= test["a"][0];
```
Expected: `{"a": [{"b": 5}, {"b": 5}]}`
Got: std.json.JSONException at std/json.d(355): JSONValue is not an array
Notably, this works:
```
test["a"] ~= JSONValue([test["a"][0]]);
```
--
More information about the Digitalmars-d-bugs
mailing list