JSON Flatten/Unflatten
Why Flatten or Unflatten JSON?
Flattening collapses a nested JSON document into a single-level object with dot-notation keys (e.g. user.address.city) — useful for spreadsheets, flat key-value stores, and form libraries. Unflattening reverses the process, rebuilding the original nested structure (including arrays) from dot-path keys.
Features
- Two-way conversion — flatten nested JSON or unflatten dot-path keys back into objects and arrays.
- Array-aware — array elements use numeric path segments and are correctly rebuilt as arrays, not objects.
- Custom delimiter — use
.,/, or any separator your system expects.
Common Use Cases
- Exporting nested JSON to a flat CSV/spreadsheet-friendly format.
- Working with key-value stores (env vars, form data) that can't hold nested structures.
- Reconstructing structured config from a flat
.env-style key list.