jsonlkit.com
JSONL (JSON Lines) utilities, in the browser
Say hi →

Repair JSONL Conversations

updated 7 September 2026 · for fine-tune / ML datasets

Conversation repair. The validators tell you the file is wrong. This makes it right. Almost every rejected fine-tune upload fails on structure rather than syntax — two turns in a row from the same speaker, a turn with nothing in it, a conversation that ends on the user's question, a system message halfway down the list — and every one of those has an obvious fix that is tedious to apply by hand across ten thousand records.

100% client-side. No upload.

Repair

Drop a .jsonl file here, or

Conversation repair

A fine-tuning API is strict about the shape of a conversation and vague about which record broke it. "Invalid message list at line 4,127" is a fact, not a plan. This applies the fix that every one of those errors implies, counts what it did, and hands the file back — so the next upload is a diff you can read rather than a second guess.

What it repairs

The order the fixes run in, and why it matters

The steps are not independent, and doing them in the wrong order leaves a file that is still invalid:

  1. Roles first. Nothing else can tell that gpt and assistant are the same speaker, so turn merging would miss the pair.
  2. Trim, then drop empties. A turn holding three spaces is only empty after it has been trimmed.
  3. System message next, so it is out of the middle before the alternation is judged — a system message between two user turns hides the fact that they are consecutive.
  4. Merge consecutive turns. Now the list is only user and assistant, and every same-role neighbour is a real one.
  5. Trim the ends last, because the earlier steps are what can leave a dangling user turn at the end.

What it will not do

A worked example

{"messages":[{"role":"user","content":"What is 2+2?"},
             {"role":"user","content":"Be brief."},
             {"role":"assistant","content":"4"}]}

becomes

{"messages":[{"role":"user","content":"What is 2+2?\n\nBe brief."},
             {"role":"assistant","content":"4"}]}

and the summary records consecutive same-role turns: 1. Run the OpenAI fine-tune validator over the output and the record that was rejected now passes.

Related