Perficient data pipelines often receive nested JSON payloads from Adobe Experience Manager and other content systems. Write a function that flattens a JSON object into a dictionary whose keys identify each leaf value by its path.
Implement flatten_json(data), where data is a JSON-compatible object represented by a Python dictionary. Traverse nested dictionaries and lists:
..items[0].None at their complete paths.{}.Dictionary keys contain only letters, digits, and underscores, so path escaping is not required. Return a new dictionary. Output key order is not significant.
def flatten_json(data):