JSON flattener
Processed in your browser · nothing is uploaded
Turns a nested structure into a single object keyed by dotted path; `user.name`, `user.tags[0]`, and turns it back again.
How to use the json flattener
Flattened JSON is what a lot of systems actually want: translation files, feature-flag stores, environment configuration and analytics payloads are all flat key-value maps, and a nested document has to be flattened to fit. The notation is the one those systems already use — dots between object keys, square brackets around array positions, so user.tags[0] reads back unambiguously.
Empty arrays and objects have no leaf to flatten into, and they are kept as explicit empty values rather than dropped. That is what makes the round trip work: a tags: [] that vanished on the way out would come back as "no such field", which is a different statement about the data.
Two shapes break the round trip, and both involve a key that looks like something else. A key that already contains a dot; {"a.b": 1}. Is indistinguishable from nesting once flattened, and comes back nested. Worse, a numeric object key becomes an array index: {"counts": {"1": 5}} flattens to counts.1 and unflattens to {"counts": [null, 5]}, because a numeric path segment can only be read as a position. If your keys are years, IDs or numeric codes, dotted notation is the wrong tool for them.
Flattening is also not the way to get JSON into a spreadsheet, though it looks close. It produces one object with many keys, not rows and columns: the JSON to CSV tool does that job properly, header row included.
Questions
Dots for object keys and square brackets for array indices, so `a.b[0].c`. That is the convention most config systems use.
For ordinary data, yes. Empty arrays and objects are preserved explicitly so they survive it.
Translation files, feature flags, environment config and analytics payloads are all flat maps that a nested document has to fit into.
It will be split on unflatten. That is a genuine limitation of dotted notation rather than a bug here.
It returns as an array index. {"counts":{"1":5}} unflattens to {"counts":[null,5]}, because a numeric segment can only mean a position.
Only as a first step, and usually not even then. The JSON to CSV tool produces rows and a header, which is what a spreadsheet wants.
No. Parsing and formatting happen in your browser, which matters when the JSON is an API response with real data in it.