Re:What's New in Python 3.12
by cameroncairns on Wednesday October 18, 2023 @02:01PM
(#37932330)
The syntax has a bit of a learning curve, but there's a library called glom that can be helpful in parsing heterogeneous JSON. Specifically it has a coalesce operator that let's you define multiple paths to get the data you are trying to get at, with a default value if none of the paths are valid.
https://glom.readthedocs.io/en/latest/api.html#defaults-with...
e.g.