Data workflow guides

Repair a JSON Lines export without changing record IDs

·

A job log uses JSON Lines, with one JSON value per physical line. A receiving program rejects the export after it finds a trailing comma and an empty line. Fix the formatting while keeping the job IDs exactly as supplied.

JSON Lines Validator and Fixer

Identify the lines blocking import

Select Load example and then Validate JSONL. The checker flags the trailing comma on line 1 and the missing value on line 2. The line 3 record is valid. Extra spaces around a JSON value are allowed, and an entire whitespace-only line is invalid.

Select Remove blank lines and Remove trailing JSON commas, then choose Validate and repair JSONL. The report should show two valid records, zero invalid lines and two repairs. The original source remains in the editor.

The rejected job export
{"id":9007199254740993,"status":"ready",}

{"id":9007199254740995,"weight":1.2300e+04}

JSON Lines format requirementsRFC 8259 — JSON values and interoperability

Inspect the exact number tokens

Download validated.jsonl and open it as UTF-8 text. Check that the first ID ends in 993, the second ID ends in 995, and the weight still reads 1.2300e+04. Many JSON consumers represent numbers as binary doubles. Use a reader with exact integer and decimal support if you need to operate on those values.

The tool writes a final LF. Each line parses separately. When a report warns that a key is repeated, investigate the producing system before importing the export into a reader that chooses one occurrence.

Expected validated JSONL
{"id":9007199254740993,"status":"ready"}
{"id":9007199254740995,"weight":1.2300e+04}

JSON Lines format requirementsRFC 8259 — JSON values and interoperability

Handle an unresolved syntax error

A missing quote or unmatched bracket requires editing the source and validating again. A comma inside a quoted string remains part of that string. If a log contains a pretty-printed object across several lines, move that JSON value onto one physical line.

JSON Lines format requirements

Common questions

Should I remove a leading BOM from a UTF-8 JSONL file?

JSON Lines starts directly with its first JSON value. Choose Remove a leading UTF-8 BOM if the checker flags that marker on line 1.

Can the last input line end without a newline?

Yes. A valid final value can end at the end of the input. The download adds a final newline for concatenation and line-oriented readers.

Sources

Put it into practice.

Related guides