JSON Lines to array
Processed in your browser · nothing is uploaded
Turns JSON Lines: one JSON value per line. Into a single array. If a line will not parse, it names the line number.
How to use the json lines to array
JSON Lines exists because a large array is awkward to stream: a consumer has to read the whole thing before acting on the first element, and a writer has to know the end before it can close the bracket. One value per line solves both, which is why log pipelines, data exports and machine-learning datasets use it. The format has exactly two rules. One complete JSON value per line, and no line breaks inside a value. The second is what people trip over, because a pretty-printed object spanning several lines is valid JSON and invalid JSON Lines.
Questions
One complete JSON value per line, with no line breaks inside a value. Also called NDJSON.
It streams. A consumer can act on line one without reading the file, and a writer can append without rewriting the end.
Almost always a pretty-printed object spanning several lines. Each value must be on exactly one line.
The error names the line number so you can go straight to it.
No. Parsing and formatting happen in your browser, which matters when the JSON is an API response with real data in it.