Skip to content
koducathome

JSONL Dataset Validator

Validate JSON Lines files line by line and check chat-format fine-tuning datasets for missing roles and empty messages.

How to use this tool

Steps for using the JSONL Dataset Validator.

  1. Paste your JSONL file into the JSONL input panel — one JSON value per line — click Upload .jsonl (read locally, never uploaded), or click Sample. It is validated as you type; pasting a JSON array offers a one-click Convert to JSONL.
  2. Pick a mode: Chat fine-tuning checks each line for a messages array, or Generic JSONL only checks that every line is valid JSON (optionally with Require objects).
  3. In chat mode, toggle the Allowed roles your provider accepts. system, user, assistant and tool are on by default; turn on developer if your dataset uses it. Flag duplicates warns about repeated examples.
  4. Problem lines are highlighted in the editor (red for errors, amber for warnings). In the Issues view, filter by severity and click any issue to jump to its line.
  5. Open Stats for valid/invalid counts, estimated tokens per example and messages by role, or Preview to read each example as a chat conversation.
  6. Use Keep valid lines only, Copy valid or Valid .jsonl to export a cleaned file that contains only the lines that passed.

Example

Find a missing assistant reply and a trailing comma

JSONL (chat mode)
{"messages":[{"role":"user","content":"Hi"},{"role":"assistant","content":"Hello!"}]}
{"messages":[{"role":"user","content":"Hi"}]}
{"messages":[{"role":"user","content":"Hi"},{"role":"assistant","content":"Hello!"},]}
Validation report
Lines: 3 · Valid: 1 · Invalid: 2 · Warnings: 0
ERROR Line 2: No "assistant" message — each example needs at least one target response
ERROR Line 3, col 85: Trailing comma is not allowed before ']'

Common use cases

  • Checking a fine-tuning dataset for empty messages, misspelled roles or missing assistant replies before uploading it.
  • Finding the one malformed line that makes a bulk import or jq pipeline fail on a large JSONL export.
  • Exporting a cleaned file that keeps only valid lines, so a partially broken dataset can still be used for a quick experiment.
  • Reviewing role balance across a dataset — for example, how many examples include a system prompt.
  • Validating NDJSON log files or API streaming captures line by line.

How JSONL validation works

JSON Lines (also called JSONL or NDJSON) stores one complete JSON value per line, separated by newline characters. Unlike a single JSON array, each line can be parsed on its own, which is why the format is popular for logs, data exports and machine-learning datasets: files can be streamed, appended to and split without re-parsing everything. The validator splits your input on line breaks, accepts both LF and CRLF endings, ignores a single trailing newline and parses each line independently with a strict RFC 8259 parser, so one broken line never hides problems on the next.

Syntax errors are reported with the line number in the file and the column inside that line, using the same messages as the JSON Validator — for example a trailing comma, single-quoted strings or an unescaped line break. Blank lines are reported as warnings because many JSONL consumers reject them; tick Skip blank lines without warning if your pipeline tolerates them. Blank and invalid lines are always left out of the downloaded file.

Chat mode checks the shape of a chat-style fine-tuning example, the common chat format used by several providers: each line is an object with a messages array, each message has a role from your allowed list and non-empty content. Content may be a string or an array of parts; parts with type: "text" must have non-empty text, and other part types are noted but not checked. Assistant messages that carry tool_calls may omit content. Every example needs at least one assistant message, and you get a warning when the conversation does not end with one, because trailing user turns are usually not trained on. Unknown top-level keys are listed as notes rather than errors.

Providers differ in the details — which roles they allow, maximum example length, minimum number of examples, whether extra keys are rejected, and how tool definitions are formatted. Treat this tool as a fast first pass that catches structural mistakes before upload, and always confirm the exact requirements in your provider's documentation. The summary's character total and rough token figure (characters ÷ 4) help you spot oversized examples; the Token Estimator explains why such figures are only estimates.

Limitations

  • Chat mode checks a common structure, not any single provider's complete rules; limits on example length, number of examples or tool schemas are not checked.
  • Only the first 500 issues are listed; the summary still counts all of them.
  • Input is limited to 2 million characters. Very large datasets should be split or checked with a script.
  • Duplicate keys inside a line are accepted (the last value wins), as with JSON.parse.

Frequently asked questions

What is the difference between JSONL, JSON Lines and NDJSON?

They describe the same idea: newline-delimited JSON with one value per line. The names come from different specifications, but in practice files with .jsonl and .ndjson extensions are interchangeable for most tools.

Does passing chat mode guarantee my provider will accept the file?

No. The tool checks the common chat format used by several providers, but each provider has its own rules on roles, extra fields, token limits and dataset size. Use this validator to catch structural errors, then check your provider's documentation for the exact requirements.

Why is a trailing newline allowed but blank lines are not?

A newline at the end of the last line is standard for text files and does not create an extra record. A blank line in the middle is an empty record that many parsers reject, so it is reported as a warning and excluded from the cleaned download.

Why does an assistant message with tool_calls not need content?

In the chat format, an assistant turn that only calls a tool usually has tool_calls and a null or missing content. The validator accepts that case; any other message without content is an error.

Is my dataset uploaded anywhere?

No. Validation runs entirely in your browser. The file is not sent to a server and its contents are never included in analytics.