One JSON object per JSONL line

CodeMoment · Updated 2026-10-31

JSONL for OpenAI chat examples is one JSON object per line. A pretty-printed conversation, a blank line between records, or a messages array with nobody answering will fail even when each fragment looks like JSON on its own.

Each non-empty line must be a single object. The object needs a messages array. Roles in that array can be system, user, assistant, tool, or developer. A training example needs an assistant message. A line that only has a user turn and a system prompt is not finished. The JSONL Validator names the line that failed and stays in the browser. It does not upload the file and it does not call a fine-tuning API.

Each message needs a role and content. Content may be a string, or a list of parts. It may be null only when tool_calls is present. A tool message also needs tool_call_id. If you set weight, the only legal values are 0 and 1. These are checks on the shape of the example, not a judgment of whether the answer is good.

A blank line is not an empty example you can leave in. OpenAI reads one object per line, so a gap between two records is an error. Delete the empty line instead of keeping it for readability. If you want to inspect one object with indentation, paste that object into the JSON Formatter. Integers larger than 9007199254740991 (2^53 - 1) keep every digit there. Put the object back on one line before it returns to the JSONL file. A formatter that uses ordinary JSON.parse would round those digits, and the rounded line is a different example.

The validator will not invent a missing assistant message, and it will not join two lines into one conversation. One line is one example. Fix the line it names, then run the check again.