Comment #0 by default_357-line — 2022-10-07T08:38:56Z
Consider this code:
```
JSONValue test = parseJSON(`{"a": [{"b": 5}]}`);
test["a"] ~= test["a"][0];
```
Expected: `{"a": [{"b": 5}, {"b": 5}]}`
Got: std.json.JSONException@std/json.d(355): JSONValue is not an array
Notably, this works:
```
test["a"] ~= JSONValue([test["a"][0]]);
```
Comment #1 by default_357-line — 2022-10-07T08:44:53Z
It is a bit unclear what `[a] ~= b` should even do if b *is* an array: `a ~ b` or `a ~ [b]`. In D, this is normally disambiguated by the typesystem. Unfortunately, JS does not have an array concat operator. Requiring ~ to be array-plus-array may genuinely be the best solution.
Comment #2 by robert.schadek — 2024-12-01T16:40:31Z