Your question is Flatten Nested JSON Paths. 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.
At Meta, event payloads from products like Facebook and Instagram may contain deeply nested JSON structures. Write a Python function that flattens a nested JSON-like object into a single dictionary of path-value pairs.
Given a Python object data representing parsed JSON, return a flat dictionary where each key is the full path to a primitive value.
Use these rules:
.[i]str, int, float, bool, None) become final entriesNone in Python)0 to 10^50 to 10^3. or bracket charactersdef flatten_json(data):