Your question is Flatten Nested JSON Records. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a Python object parsed from JSON, write a function that flattens it into a list of row dictionaries. Nested objects should be flattened using dot-separated keys, and arrays should be expanded by index using bracket notation such as items[0].id. If the input is a single object, return one flattened row; if it is a list of objects, return one flattened row per object.
def flatten_json_payload(payload):