JSONL Formatter
100% client-side. No upload.
Format
JSONL Formatter
Pretty-print each line of a JSONL file with a configurable indent, or minify it back down. Useful for eyeballing a small dataset without pulling it into an editor.
Before you start
You need a .jsonl or .ndjson file, or a snippet of JSON Lines text to paste.
Technically, this tool also works on regular JSON files, but it's designed to handle multiple
JSON objects separated by newlines.
Keep in mind that "Pretty-printed JSONL" is a bit of a contradiction. The JSONL specification requires every record to live on a single line. When you use this tool to "pretty print," it will expand those records across multiple lines for readability. I built this so you can actually read your data, but remember: you'll need to Minify it back down before feeding it into a database or an AI training pipeline.
There is no hard file size limit, but everything happens in your browser's memory. For files over 50 MB, you might notice some lag while the textareas render. If you're dealing with gigabyte-scale logs, a CLI tool is still your best bet.
How to use it
- Paste your JSONL text into the Input pane, or drop a file onto the page.
- Set your preferred Indent (usually 2 or 4 spaces).
- Click Pretty print to expand the JSON objects into a human-readable format.
- If you're cleaning up a file for production, click Minify to collapse everything back to one line per record.
- Check the status bar for any line-specific syntax errors.
- Click Copy or Download to save your work.
Options explained
Indent
This sets the number of spaces used for nesting. I've capped this at 8 spaces to keep the output from flying off the right side of your screen. 0 indent is essentially a "pretty minify" where you get newlines between keys but no horizontal spacing.
Pretty print vs. Minify
Pretty print uses JSON.stringify to add whitespace and newlines
within each object. It's great for debugging or manual editing. Minify
removes all internal whitespace, ensuring each object occupies exactly one line of text,
which is the standard format for NDJSON.
Example
Input (Minified):
{"id":1,"user":"alice","meta":{"v":1}}
{"id":2,"user":"guest","meta":{"v":1}}
Output (Pretty print, 2-space indent):
{
"id": 1,
"user": "alice",
"meta": {
"v": 1
}
}
{
"id": 2,
"user": "guest",
"meta": {
"v": 1
}
}
Tips & common pitfalls
- The "Pretty" trap. Most JSONL parsers will crash if you give them the pretty-printed version. Always Minify before uploading to OpenAI (use our OpenAI Fine-Tune JSONL Validator for training sets), BigQuery, or Spark.
- Empty lines are ignored. I've designed the parser to skip blank lines, so you don't get "Invalid JSON" errors for the spacing between records.
- Key order is preserved. Modern browsers generally maintain the insertion order of object keys, so your
"id"should stay at the top where it belongs. - Validation is included. If a single line in your file is broken (missing a comma or a quote), the tool will point you to the exact line number—much like the JSONL / NDJSON Viewer—so you can fix it manually.
Troubleshooting
I get "Unexpected token" errors on every line.
Check if you're actually pasting a JSON array (starts with [ and ends with ]). If so, use the JSONL ↔ JSON Array tool to convert it to lines first.
The "Copy" button isn't working.
If your file is massive, the browser's clipboard API might struggle. Try clicking Download instead to save the output directly to a file.
Why are there extra newlines between my pretty-printed objects?
I add a double newline between formatted records to make them easier to distinguish visually. These disappear completely when you switch back to Minify mode.
Related tools
See also: if you need to do something adjacent on this site, try JSONL to CSV to flatten JSONL into a CSV with dotted keys, JSONL to JSON to convert JSONL into a JSON array (or back), or OpenAI Fine Tune Validator to validate an OpenAI fine-tune file against the chat schema.
Frequently asked questions
Is pretty-printed JSONL still valid for production?
Almost certainly not. The NDJSON and JSONL standards require each record to be a single line. This tool's "Pretty" mode is strictly for humans to read; use "Minify" for machines.
Can I use Tabs for indentation?
Currently, no. I've standardized on spaces because that's how the underlying JavaScript engine handles formatting. If you need tabs, you'll need to run a find-and-replace on the output.
Does this tool handle Unicode or special characters?
Yes. The tool uses standard browser encoding. Non-ASCII characters (like emojis or non-Latin scripts) are preserved as-is unless they were already escaped in your source text.
Is my data sent to a server?
Never. I built this to run entirely in your browser's JavaScript engine. Your data stays on your machine, which makes it safe for sensitive logs or private AI training data. Check the privacy policy if you're curious.
What is the difference between JSONL and NDJSON?
For 99% of use cases, they are identical. Both represent a stream of JSON objects separated by newlines. JSONL is the name used by the formal spec, while NDJSON (Newline Delimited JSON) is often used in data engineering circles.