| ... | ... | @@ -1323,7 +1323,8 @@ pub const Parser = struct { |
| 1323 | 1323 | p.state = State.ObjectKey; |
| 1324 | 1324 | }, |
| 1325 | 1325 | // Array Parent -> [ ..., <array>, value ] |
| 1326 | | Value.Array => |*array| { |
| 1326 | Value.Array => { |
| 1327 | var array = &p.stack.items[p.stack.len - 1].Array; |
| 1327 | 1328 | try array.append(value); |
| 1328 | 1329 | p.state = State.ArrayValue; |
| 1329 | 1330 | }, |
| ... | ... | @@ -1364,7 +1365,8 @@ test "json parser dynamic" { |
| 1364 | 1365 | \\ "Width": 100 |
| 1365 | 1366 | \\ }, |
| 1366 | 1367 | \\ "Animated" : false, |
| 1367 | | \\ "IDs": [116, 943, 234, 38793] |
| 1368 | \\ "IDs": [116, 943, 234, 38793], |
| 1369 | \\ "ArrayOfObject": [{"n": "m"}] |
| 1368 | 1370 | \\ } |
| 1369 | 1371 | \\} |
| 1370 | 1372 | ; |
| ... | ... | @@ -1387,4 +1389,10 @@ test "json parser dynamic" { |
| 1387 | 1389 | |
| 1388 | 1390 | const animated = image.Object.get("Animated").?.value; |
| 1389 | 1391 | debug.assert(animated.Bool == false); |
| 1392 | |
| 1393 | const array_of_object = image.Object.get("ArrayOfObject").?.value; |
| 1394 | debug.assert(array_of_object.Array.len == 1); |
| 1395 | |
| 1396 | const obj0 = array_of_object.Array.at(0).Object.get("n").?.value; |
| 1397 | debug.assert(mem.eql(u8, obj0.String, "m")); |
| 1390 | 1398 | } |