JSONL Validator for JSON Lines Files – Free

This JSONL validator parses each line of a JSON Lines file as a separate JSON value and tells you which line numbers fail. Use it before you upload a dataset or feed a log pipeline.

How to use the JSONL validator tool

  1. Paste the contents of your .jsonl or .ndjson file into the JSON Lines box, or select Example for a two-record sample.
  2. Select Validate to check every line.
  3. If all lines parse, the Result box shows the record count, for example 2 valid JSON records.
  4. If any line fails, the status message under the result lists the line numbers, such as Invalid JSON on lines: 4, 5.
  5. Fix the reported lines, paste the text again and repeat until the count appears.

What the JSON Lines format requires

JSON Lines, also written JSONL or NDJSON, stores one complete JSON value per line. Lines are separated by a line feed, the file is UTF-8, and there is no enclosing array and no comma between records. Because each line stands alone, a program can append records, stream them or split the file without parsing the whole thing.

The price of that simplicity is that one record must never span lines. A pretty-printed object, or a string containing a raw line break where the \n escape belongs, breaks the file even though the same data would be fine as regular JSON.

How this JSONL validator checks a file

The input is split on LF or CRLF line endings. Lines that are empty or contain only whitespace are skipped and do not count as records. Every other line goes through the browser's strict JSON parser, and the tool collects the number of each line that is rejected.

Line numbers refer to the position in the pasted text, blank lines included, so they match what your editor shows. Any JSON value is accepted as a record: objects, arrays, strings, numbers, true, false and null. In the sample below, line 4 has a trailing comma and line 5 uses single quotes.

{"prompt":"Hi","completion":"Hello"}

{"prompt":"Bye","completion":"See you"}
{"prompt":"Oops",}
{'prompt':"x"}

Invalid JSON on lines: 4, 5.

Common reasons a line fails

The message gives line numbers only, so use this list to find the cause on each one.

  • A trailing comma before the closing brace or bracket.
  • Single quotes or unquoted keys, which JavaScript allows and JSON does not.
  • A record that was pretty-printed across several lines. Each fragment is reported as its own bad line.
  • Two records on one line, for example after line breaks were lost in a copy.
  • Comment lines starting with # or //.
  • A byte order mark at the start of the first line, or values such as NaN and undefined.

What validation does not cover

A pass means every record is syntactically valid JSON. The tool does not check that records share the same keys, that required fields such as messages or prompt exist, or that the file meets the size and token rules of a fine-tuning or batch API. Duplicate keys inside an object are also accepted, because the browser's parser allows them. Run a schema check in your own code for those rules.

Frequently asked questions

What is the difference between JSON and JSONL?

A JSON file holds one value, usually an object or an array, and can be formatted across many lines. A JSONL file holds many values, one per line, with no wrapping array or separating commas. JSONL suits logs, exports and training data that are processed record by record.

Are blank lines allowed in a JSONL file?

This validator ignores blank and whitespace-only lines and does not count them. Stricter consumers may reject them, so remove empty lines in the middle of a file before you send it to another system. A single newline after the last record is fine.

Is JSONL the same as NDJSON?

For practical purposes, yes. Both describe newline-delimited JSON with one value per line, and files in either convention are checked the same way here.

Is my dataset uploaded when I validate it?

No. The lines are parsed by JavaScript in the page, and nothing you paste leaves the browser.

How do I convert a JSON array to JSONL?

Write each array element on its own line as compact JSON. With jq, the command jq -c '.[]' file.json does this. Then paste the output here to confirm that every line parses.

Related tools