with nested schema and indexed lookups, I think any .get based solution would be the same complexity. In this case I’d probably just do try except with KeyError, IndexError as you mentioned.
It would be nice if there was a ‘json.get()’ option where you could cleanly pass it this and a default and had if handle this for you. Probably wouldn’t be too hard to implement.
View all comments
Show parent comment
12
u/ColdPorridge Jul 14 '21
with nested schema and indexed lookups, I think any .get based solution would be the same complexity. In this case I’d probably just do try except with KeyError, IndexError as you mentioned.
It would be nice if there was a ‘json.get()’ option where you could cleanly pass it this and a default and had if handle this for you. Probably wouldn’t be too hard to implement.