json_normalize with multiple record paths json_normalize with multiple record paths pandas pandas

json_normalize with multiple record paths


json_normalize is designed for convenience rather than flexibility. It can't handle all forms of JSON out there (and JSON is just too flexible to write a universal parser for).

How about calling json_normalize twice and then merge. This assumes each state only appear once in your JSON:

counties = json_normalize(data, 'counties', ['state', 'shortname'])governors = json_normalize(data, 'info', ['state'])result = counties.merge(governors, on='state')