Your question is Transform JSON Logs to Tables. 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.
Write a Python function to parse and transform complex JSON logs into a structured tabular format.
Implement parse_logs(logs). Each input element is a JSON object representing one log record. Flatten nested objects using dot-separated keys, preserve scalar values, and encode arrays as compact JSON strings. Return a list of row dictionaries with the union of all flattened columns, sorted lexicographically. Fill missing columns with None.
Input: a list of JSON-compatible dictionaries. Output: a list of dictionaries. The input order must be preserved.
def parse_logs(logs):