Flatten turns nested JSON into a single-level object whose keys are paths, such as user.address.city or user.roles[0]. Unflatten does the reverse and rebuilds the nested structure.
You can change the separator (for example / or __ for environment-variable style keys) and pick how array indexes are written: brackets (tags[0]) or the separator (tags.0). In separator mode, numeric segments are rebuilt as arrays when unflattening.
Empty objects and arrays are kept as {} and [] values so a round trip does not lose them. If your original keys already contain the separator, pick a different separator, otherwise unflatten cannot tell the two apart. Everything runs locally.