Your question is Flatten Deeply Nested Objects. 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.
ThoughtSpot frontend surfaces often pass deeply nested configuration objects between components. Implement flatten_object to convert a nested object into a single-level object whose keys represent paths from the root.
A nested object key should be joined to its parent path with .. Treat arrays and primitive values as leaf values and do not flatten objects inside arrays. Empty objects are also leaf values. The input object and all nested keys are JSON-compatible, and no key contains ..
obj, a non-null Python dictionary whose values are dictionaries, arrays, strings, numbers, booleans, or None.{} for an empty input object..def flatten_object(obj):