JSONL Flatten / Unflatten
100% client-side. No upload.
Transform
Drop a .jsonl file here, or
JSONL Flatten / Unflatten
Flatten nested JSONL records into a flat key-value shape using dot notation (user.name, tags.0), or take a flat shape and unflatten the dotted keys back into nested objects and arrays. The same transformation pandas does with json_normalize(), but in your browser. 100% client-side.
— S., [email protected]
Why flatten?
- ML feature stores expect a flat table. Flattening lets you go from nested JSON exports straight to pandas / scikit-learn without writing custom column-extraction code.
- Excel / Sheets / BigQuery don't deal well with nested JSON columns. A flat shape is a clean schema with one column per leaf value.
- Diff & review: comparing two records is much easier when every value lives at a stable dotted path.
Why unflatten?
- Round-trip from CSV / Excel. If you flattened, did some editing in a spreadsheet, and converted back to JSONL, unflattening restores the original nested shape.
- API ingestion. Many APIs take nested payloads. If your source data is flat, unflattening builds the right shape with one tool.
Array style
Three options for how to represent array indices:
Dotted (tags.0, tags.1) — friendliest for column
names. Bracket (tags[0]) — pandas/JMESPath-flavoured.
Join (tags = "admin,ops") — loses array structure
but produces fewer columns; useful when the array contents are display-only strings.
Tips & common pitfalls
- Keys with dots in them. If your source data has literal dots in keys (e.g.
"version 1.2"), pick a different separator like|or__. - Empty objects and arrays are kept as empty leaves with the key path pointing to
""(ornullin unflatten direction) so they round-trip. - Unflatten is permissive. Any key that doesn't contain the separator is left at the top level. Numeric-only path segments build arrays; otherwise objects.
Example
Input nested JSONL:
{"id":1,"user":{"name":"alice","email":"[email protected]"},"tags":["admin","ops"]}
{"id":2,"user":{"name":"bob","email":"[email protected]"},"tags":["dev"]}
Flattened (dot, dot-index array style):
{"id":1,"user.name":"alice","user.email":"[email protected]","tags.0":"admin","tags.1":"ops"}
{"id":2,"user.name":"bob","user.email":"[email protected]","tags.0":"dev"}