JSONL Viewer
Validate JSON Lines Instantly
Paste JSONL or NDJSON content to validate each line individually, view records as collapsible trees, and convert between JSONL and JSON arrays. Works with OpenAI fine-tuning files, Elasticsearch bulk data, log files, and LLM training datasets.
Open JSONL ViewerPer-Line Validation
Each line is validated independently. Errors report the exact line number and position, making it easy to find and fix bad records in large files.
Tree View Per Record
Every valid record is displayed as a collapsible tree with syntax highlighting — the same view used for regular JSON formatting.
Convert JSONL ↔ JSON
Convert JSONL to a JSON array and back in one click. Useful for ingesting JSONL into tools that expect a standard JSON array.
Everything you need for JSON Lines
{"messages":[…]} per line), Hugging Face datasets, and most AI training pipelines.
Your data stays in your browser
100% client-side processing
JSONL processing runs entirely in your browser. Log files and training data containing sensitive information are never uploaded or transmitted.
Related JSON tools
Common questions answered
What is JSONL?
JSONL (JSON Lines) is a format where each line is a valid JSON value, typically an object. It is also called NDJSON (Newline Delimited JSON). It is widely used for log files, LLM training data, OpenAI fine-tuning datasets, Elasticsearch bulk imports, and data pipelines.
What is the difference between JSONL and JSON?
Regular JSON has one root value (an object or array). JSONL has one JSON value per line, making it easy to append records and stream data without loading the entire file. It is the standard format for OpenAI fine-tuning files and most AI training datasets.
Is this JSONL viewer free?
Yes, completely free with no account required.
Does the JSONL viewer send my data to a server?
No. All processing is 100% client-side in your browser — your data never leaves your device.
Can I convert a JSONL file to a regular JSON array?
Yes. jsonfmt.dev can convert JSONL to a JSON array (wrapping all records in []) and convert a JSON array back to JSONL (one record per line).
What is JSONL (JSON Lines)?
JSONL (JSON Lines), also called newline-delimited JSON (NDJSON), is a format where each line contains a separate valid JSON document. Unlike a single JSON array, JSONL allows line-by-line processing — ideal for log files, streaming data, database exports, and large datasets that will not fit in memory as a single document.
This viewer parses JSONL by splitting on newlines and parsing each line independently. It displays records in table, tree, or code view with navigation between lines. For large files, line-by-line parsing means the viewer shows results before the entire file is parsed — unlike tools requiring the complete dataset to be loaded first.
{"ts":"2024-01-15T10:00:00Z","level":"info","msg":"Server started"}
{"ts":"2024-01-15T10:00:05Z","level":"error","msg":"DB timeout"}
{"ts":"2024-01-15T10:00:06Z","level":"info","msg":"Reconnected"}
┌─────────────────────┬───────┬────────────────┐ │ ts │ level │ msg │ ├─────────────────────┼───────┼────────────────┤ │ 2024-01-15T10:00:00 │ info │ Server started │ │ 2024-01-15T10:00:05 │ error │ DB timeout │ │ 2024-01-15T10:00:06 │ info │ Reconnected │ └─────────────────────┴───────┴────────────────┘
Get the most out of this tool
- JSONL is preferred for streaming APIs and log aggregation — each line is independently parsable even if the stream is interrupted.
- Use JSONL instead of a JSON array when datasets are too large to fit in memory — process one line at a time.
- Most database export tools support JSONL output (mongodump, PostgreSQL COPY) — use this viewer to inspect results.
Understanding JSONL — the streaming JSON format
JSONL (JSON Lines) is a text format where each line is an independent, complete JSON value — typically a JSON object. Also called NDJSON (Newline-Delimited JSON), it was designed to solve the streaming and append challenges of standard JSON. A standard JSON array requires the entire document to be valid before parsing begins, making it unsuitable for streaming or incremental append. JSONL's one-record-per-line design eliminates this constraint.
The streaming advantage of JSONL is its most important property. A log aggregator can write millions of events to a JSONL file by simply appending new lines — no need to open the file, parse the existing array, add a new element, and re-serialize the whole document. A consumer can begin reading and processing records from line one without waiting for the file to complete. This makes JSONL the format of choice for log files, event streams, and data pipelines.
JSONL files are trivially parallelizable for processing. Because each line is independent, a multi-threaded processor can split the file at line boundaries and process chunks in parallel without coordination. Standard tools like cat, head, tail, wc -l, grep, and sort all work correctly on JSONL files — the newline delimiter makes JSONL files behave like any text file for line-oriented Unix tools.
The jq command-line tool has native JSONL support. Running jq '.field' data.jsonl processes each line independently, applying the filter to each JSON object and outputting one result per line. This enables powerful one-liner data transformations on large JSONL datasets without loading the entire file into memory. The --slurp flag collects all lines into a JSON array for cross-record operations like aggregation.
Machine learning and AI datasets are frequently distributed as JSONL files. OpenAI's fine-tuning API accepts training data as JSONL where each line contains a messages array representing one conversation. Hugging Face datasets for NLP tasks use JSONL for train, validation, and test splits. The format's simplicity — any text editor can open and inspect a JSONL file — makes it accessible for dataset inspection and quality control.
Database export tools commonly produce JSONL output. MongoDB's mongoexport and the Google BigQuery export all produce JSONL by default. This format choice reflects the document-per-line pattern mapping naturally to database records, and the streaming design enabling efficient import with mongoimport without loading the entire dataset into memory first.
Error handling in JSONL streams is per-line. If one line contains malformed JSON, a robust JSONL processor can skip that line, log the error, and continue processing subsequent lines — unlike a standard JSON array where a single malformed element invalidates the entire document. This resilience to partial corruption makes JSONL suitable for long-running log streams where occasional write failures might truncate a line.
Real-world uses for JSONL format
grep, and streaming analysis with jq.
JSONL pitfalls to avoid
- Embedding newlines inside JSONL values: JSONL uses newlines as record delimiters. If a JSON string value contains a literal newline character, it must be escaped as
\n— never as a real line break. Real newlines inside a JSONL record corrupt the format by splitting one record across two lines. - Missing newline at end of file: JSONL files should end with a newline character after the last record. Files without a trailing newline cause some parsers to treat the last line as incomplete. Most text editors add trailing newlines automatically — verify with
xxd file.jsonl | tail -3to check the last bytes. - Treating JSONL as a JSON array: JSONL is not a JSON array. You cannot parse a JSONL file with
JSON.parse()— the multiple JSON objects separated by newlines are not valid JSON. Use a JSONL-specific parser or split the file by newlines and parse each line individually. - Assuming all lines have the same schema: JSONL files can contain heterogeneous records — different lines can have different fields. This is common in event log files where different event types have different payloads. Always validate each line independently rather than assuming schema consistency across the file.
Additional frequently asked questions
What is the difference between JSONL and NDJSON?
JSONL (JSON Lines) and NDJSON (Newline-Delimited JSON) are the same format with different names. Both require each line to be a complete, valid JSON value separated by newline characters. The JSONL name is more commonly used in the data engineering community; NDJSON is used in the streaming API community. The formats are fully interchangeable.
Can a JSONL file contain values other than objects?
Yes — technically any valid JSON value can appear on each line of a JSONL file, including arrays, strings, numbers, and booleans. However, the most common and useful case is one JSON object per line, where the object represents one record. Lines containing arrays or primitive values are less common but valid JSONL.
How do I convert a JSONL file to a JSON array?
Using jq: run jq --slurp '.' file.jsonl to collect all lines into a JSON array. Using Python: read all lines, parse each with json.loads(), collect in a list, and serialize with json.dumps(). This tool's JSONL tab can display and convert JSONL files directly in the browser.
Is there a file size limit for the JSONL viewer?
This viewer processes JSONL entirely in the browser with no file size limits imposed by a server. Large files (over 100KB) are processed in a Web Worker to keep the UI responsive. For very large JSONL files with millions of lines, the viewer shows paginated results to avoid DOM performance issues from rendering all records simultaneously.