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):