Thank you very much, @albertdahlin! I updated the to add the common fields for my own understanding here.
In practice, the JSON I’m decoding has more than 8 fields so I’ve been using Json.Decode.Pipeline
for the decoding, which seems to be causing some issues still. But with the help I’ve received from this thread, I think I should be able to get through it now.
I also found Json.Decode.Extra.when
which seems like it would be another way to solve this problem. (Edit: I just needed to use custom ...
instead of required "type" ...
at the appropriate point in the pipeline).
Thanks again for all the help!