JSONL Validator
A free JSONL validator that checks JSON Lines files line by line, with exact line numbers and error messages, an optional chat fine-tuning format check and a download of only the valid lines.
| Line | Problem |
|---|
Find the Broken Line in Your JSONL File
JSON Lines (JSONL, also called NDJSON) stores one JSON value per line. It is the standard format for LLM fine-tuning data, batch API requests, evaluation sets and log exports. One stray comma or unescaped quote breaks an upload, and the error message rarely says which of thousands of lines is wrong.
This JSONL validator parses every line separately and lists each problem with its exact line number. It can also check the chat fine-tuning format, show any line pretty-printed, and let you download a clean file with only the valid lines. Files are read in your browser and never uploaded.
How to validate a JSONL file
- Paste your JSON Lines or click Open file to load a
.jsonlor.ndjsonfile from your computer. - Choose the check. Leave the chat fine-tuning option ticked for training data, or untick it to check only that every line is valid JSON.
- Fix the errors. Each problem is listed with its line number. Click a number to see that line in the pretty view.
- Download the valid lines if you want to drop broken records instead of fixing them.
The JSON Lines format
Each line is one complete JSON value, usually an object, and lines are separated by a newline (\n). There is no surrounding array and no comma between lines. Strings inside a line must keep newlines escaped as \n, because a real line break would end the record. Files should be UTF-8 encoded; a trailing newline after the last line is allowed.
The usual file extensions are .jsonl and .ndjson. Because every record stands alone, a JSONL file can be streamed, split into parts or appended to without parsing the whole file, and one corrupt line does not make the rest unreadable.
Common JSONL errors and fixes
| Problem | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} | Remove the last comma |
| Single quotes | {'a': 1} | Use double quotes for keys and strings |
| Pretty-printed record | An object spread over several lines | Minify each record to one line |
| File is a JSON array | [{...}, {...}] | Write one object per line without brackets |
| Unescaped quote | {"q": "say "hi""} | Escape it as \" |
| Byte order mark | Invisible U+FEFF at the start | Save as UTF-8 without BOM |
Chat fine-tuning format
Chat training data uses the chat completions message structure: every line is an object with a messages array, and each message has a role and content.
{"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hi"}, {"role": "assistant", "content": "Hello! How can I help?"}]}
The check accepts the roles system, developer, user, assistant and tool, requires at least one assistant message, allows assistant messages with tool_calls instead of text, and accepts an optional weight of 0 or 1 on assistant messages (0 excludes that turn from training). OpenAI requires at least 10 examples per training file. Other platforms may accept extra fields, so treat this as a structural check, not a full validation of every provider’s rules.
Tips for clean training data
- Generate, do not hand-edit. Write JSONL with a JSON library (
json.dumpsper record) rather than string concatenation. - Check the size. Long examples can exceed a model’s context window; measure them with the LLM Token Counter.
- Remove hidden characters. Text scraped from the web may contain zero-width or bidi characters; clean them with the Invisible Character Cleaner.
- Define the output shape for structured tasks with the JSON Schema Builder.
Frequently Asked Questions
Common questions about JSONL files and validation.
JSONL (JSON Lines) is a text file where every line is a separate, valid JSON value, usually an object. It is easy to stream, append to and process line by line, which is why LLM fine-tuning and batch APIs use it.
A JSON file holds one value, often a large array. A JSONL file holds many independent values, one per line, with no surrounding brackets and no commas between records.
Practically yes. NDJSON (newline-delimited JSON) and JSON Lines describe the same idea, and this validator accepts both.
A blank line is not a JSON value, so strictly it is invalid. Many tools skip blank lines, so they are counted separately as empty instead of as errors.
Yes, structurally. With the chat option on, each line must have a messages array with valid roles and content and at least one assistant message, and you are warned if there are fewer than 10 examples.
Yes. Files are read locally, so the limit is your browser’s memory. Files with hundreds of thousands of lines work, but very large files may take a few seconds to check.
No. The file is read with your browser’s FileReader and validated on your device. Nothing is sent to a server.
Parse the array and write each element with JSON.stringify (or json.dumps) on its own line. The XML to JSON converter helps if your data starts as XML.