Panic when recursively processing a std.json.Parsed(std.json.Value) object

before i get into details about my use-case, perhaps someone has some insight into what this panic means…

thread 24532 panic: access of union field 'array' while field 'object' is active
C:\Users\biosb\zig\zig-em-dev\src\BundlePath.zig:37:39: 0x4627c3 in add (zig-em.exe.obj)
    for (jobj.object.get("requires").?.array.items) |e| add(root_dir, e.string);
                                      ^
C:\Users\biosb\zig\zig-em-dev\src\BundlePath.zig:37:60: 0x46283d in add (zig-em.exe.obj)
    for (jobj.object.get("requires").?.array.items) |e| add(root_dir, e.string);
                                                           ^
C:\Users\biosb\zig\zig-em-dev\src\Session.zig:29:19: 0x461f76 in activate (zig-em.exe.obj)
    BundlePath.add(work_root, bname);

You assume that jobj.requires is an array:

{
  "requires": [
    ...
  ]
}

but it is an object:

{
  "requires": {
    ...
  }
}

good catch…

i’m using zon2json which apparently converted an (empty) array in my original .zon file to an empty object (and not a zero-length array) in the json it produced…

clearly "requires": [] is legal json…

my .zon file had .requires = .{ } which i now understand can be misinterpreted as an empty object…

i can obviously handle this situation in my own code… but it begs the question – is there a “natural” way to denote an array within zon??? i’m sure this is a can of worms, but having [ ... ] to mean an array while having { ... } to mean an object would allow zon to distinguish between a zero-length array and an object with no fields…