Convert JSONL to JSON
JSON Lines files are easy for programs to stream but awkward for people to read and for many tools to import. A JSONL to JSON conversion parses every line as its own JSON value and collects the results into one formatted array, the shape most editors, viewers, test fixtures and APIs expect.
Example: structured log records
{"ts":"2024-05-01T10:00:00Z","level":"info","msg":"server started"}
{"ts":"2024-05-01T10:00:05Z","level":"error","msg":"db timeout"}
Converted with a 2-space indent ("2 records parsed"):
[
{
"ts": "2024-05-01T10:00:00Z",
"level": "info",
"msg": "server started"
},
{
"ts": "2024-05-01T10:00:05Z",
"level": "error",
"msg": "db timeout"
}
]
Line-by-line parsing and error reporting
Because every line is parsed on its own, a problem in one record is reported precisely. The message names the record and the line number in your file, counting blank lines, so it matches what you see in the editor. For example, this input:
{"ts":1,"level":"info"}
{"ts":2,"level":"warn"}
{"ts":3,"level":error}
fails with Invalid JSON record: Expected a value (string, number, object, array, true, false or null) but found 'e' (line 4, column 17): the value error on line 4 is missing its quotes. The conversion stops at the first bad record rather than silently dropping it, so the array you copy is always complete.
Input rules
- Blank lines are skipped, including a trailing newline at the end of the file.
- Windows line endings (CRLF) are handled like Unix ones.
- Any JSON value can be a record. Lines holding numbers, strings or
nullare accepted and become array elements, not only objects. - A JSON array is accepted too. If you paste a whole array by mistake, it is formatted as-is and the status bar notes that the input was already a JSON array.
- Each record must fit on one line. A pretty-printed object spread over several lines is not JSON Lines, and its first line is reported as an unfinished record.
Where JSONL files come from
You will meet JSON Lines in log files written by structured loggers, in exports from databases and data warehouses, in the result files of batch APIs and in machine learning datasets. mongoexport writes one document per line by default, for example. All of them can be pasted or uploaded here as they are.
Records do not need to share the same shape. The sample log on this page has a port field in one record and a retry flag in another; the array keeps every record exactly as written, without adding missing keys or reordering anything.
After converting
A formatted array is easier to inspect, but for thousands of records the JSON viewer with its collapsible tree is more comfortable. To pull specific fields out of every record, query the array with the JSONPath tester, for example $[*].msg. For spreadsheet work, convert the array onward with JSON to CSV.
The JSON → JSONL button on the same page reverses the process, writing each element of an array back onto its own line.
Privacy
Log files and dataset exports often contain personal data. The conversion runs entirely in your browser; nothing is uploaded unless you use Load URL, which fetches through our server, or Save & Share, which stores the input to create a link.