Flattening turns structure into path strings
Flattening walks a nested document depth-first and, for every leaf value it reaches, records the route it took to get there as a single string key. `{"user":{"address":{"city":"Oslo"}}}` becomes `{"user.address.city":"Oslo"}`. The values are untouched; only the keys change, absorbing the nesting that used to be expressed by braces.
Array elements get bracketed numeric indices, so `{"tags":["a","b"]}` becomes `{"tags[0]":"a","tags[1]":"b"}`. Keeping brackets rather than using another dot is what makes the operation reversible: `items[0]` is unambiguously an array index, while `items.0` could equally be an object key that happens to be the string `"0"`.
The result is always exactly one level deep, which is the whole point. A flat map of string keys to scalar values is the shape that spreadsheets, environment variables, translation catalogues, form libraries and key-value stores all expect.