Flatten nested JSON into single-level dot-notation keys, or unflatten dotted keys back into a nested object. Useful for configs, i18n files and diffs.
It rewrites a nested object so every value sits at the top level under a single key that traces its path, joined by dots. For example {"a":{"b":1}} becomes {"a.b":1}. Unflatten reverses it back to the nested form.
Flattened keys are great for translation (i18n) files, environment-style configs, comparing two JSON objects (diffs line up by full path), and feeding nested data into tools that only accept flat key-value pairs.
Arrays are kept intact as values rather than split into indexed keys, which keeps the round-trip clean and predictable. Only nested objects are flattened into dotted paths.