Your question is Flatten Nested JSON Config. 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.
Astra's IFS-supported systems store spacecraft configuration as nested JSON objects and arrays. Implement a function that flattens this structure into a dictionary whose keys represent each value's path.
Use dot notation for object keys and zero-based bracket notation for array indexes. For example, {"guidance": {"mode": "safe"}} becomes {"guidance.mode": "safe"}. Scalar values include strings, numbers, booleans, and null. Preserve empty nested objects and arrays as values at their paths. An empty root object or array produces {}.
Object keys are guaranteed not to contain . or bracket characters, so generated paths are unambiguous. The input root is always a JSON object or array. Because configurations may be deeply nested, the preferred solution should avoid Python's recursive call-depth limit.
config, a JSON-compatible Python dictionary or list.., and array elements use [index].def flatten_config(config):