Sample JSONL File Download
Twelve JSON Lines files for testing parsers, importers and data pipelines. Eleven are valid and one is broken on purpose, so you can check both paths in your code.
Twelve JSON Lines files, each for a different test
Flat records: eight user accounts
The plainest kind of JSON Lines file. Every line is one object with the same six keys, which is what most importers and tutorials expect.
{"id":1,"name":"Ada Mensah","email":"ada.mensah@example.com","plan":"free","active":true,"signed_up":"2026-01-14"}
{"id":2,"name":"Bruno Castell","email":"bruno.castell@example.com","plan":"pro","active":true,"signed_up":"2026-01-20"}
{"id":3,"name":"Chen Rui","email":"chen.rui@example.com","plan":"team","active":false,"signed_up":"2026-02-02"}
{"id":4,"name":"Dalia Haddad","email":"dalia.haddad@example.com","plan":"free","active":true,"signed_up":"2026-02-11"}
{"id":5,"name":"Emil Larsen","email":"emil.larsen@example.com","plan":"pro","active":true,"signed_up":"2026-03-05"}
{"id":6,"name":"Farah Qureshi","email":"farah.qureshi@example.com","plan":"team","active":true,"signed_up":"2026-03-19"}
{"id":7,"name":"Goran Petrov","email":"goran.petrov@example.com","plan":"free","active":false,"signed_up":"2026-04-01"}
{"id":8,"name":"Hana Sato","email":"hana.sato@example.com","plan":"pro","active":true,"signed_up":"2026-04-23"}
Nested objects and arrays inside each line
Five orders, each with a customer object, an address inside it and an items array. One order has no items and one has an extra discounts array. Use it to test flattening and table conversion.
{"order_id":"A-1001","placed_at":"2026-05-02T09:14:00Z","customer":{"id":2,"name":"Bruno Castell","address":{"city":"Lisbon","country":"PT"}},"items":[{"sku":"KB-204","qty":1,"price":79},{"sku":"MS-110","qty":2,"price":24.5}],"total":128,"paid":true}
{"order_id":"A-1002","placed_at":"2026-05-02T11:40:00Z","customer":{"id":5,"name":"Emil Larsen","address":{"city":"Aarhus","country":"DK"}},"items":[{"sku":"HD-880","qty":1,"price":149.99}],"total":149.99,"paid":true}
{"order_id":"A-1003","placed_at":"2026-05-03T08:05:00Z","customer":{"id":8,"name":"Hana Sato","address":{"city":"Osaka","country":"JP"}},"items":[],"total":0,"paid":false,"note":"Cart abandoned before items were confirmed"}
{"order_id":"A-1004","placed_at":"2026-05-03T16:22:00Z","customer":{"id":1,"name":"Ada Mensah","address":{"city":"Accra","country":"GH"}},"items":[{"sku":"CB-015","qty":3,"price":9.9},{"sku":"KB-204","qty":1,"price":79},{"sku":"ST-330","qty":1,"price":34}],"total":142.7,"paid":true,"discounts":[{"code":"SPRING10","amount":14.27}]}
{"order_id":"A-1005","placed_at":"2026-05-04T13:51:00Z","customer":{"id":6,"name":"Farah Qureshi","address":{"city":"Lahore","country":"PK"}},"items":[{"sku":"MN-270","qty":2,"price":219}],"total":438,"paid":false}
Arrays instead of objects, with a header row
Each line is a JSON array, and the first line holds the column names. It reads like CSV but keeps real numbers and booleans. A reader that assumes every line is an object will fail here.
["city","country","population_millions","capital"]
["Nairobi","Kenya",4.4,true]
["Porto","Portugal",0.2,false]
["Lima","Peru",10.1,true]
["Osaka","Japan",2.7,false]
["Wellington","New Zealand",0.2,true]
Every kind of JSON value, one per line
A number, a string, true, null, an array, an object and an exponent number. All seven lines are valid, because a line may hold any JSON value. The null line is the one that trips up loose parsers.
42
"a plain string"
true
null
[1,2,3]
{"key":"value"}
6.02e23
Chat fine-tuning examples in OpenAI's messages layout
Ten training examples, each a messages array with one user turn and one assistant turn. Ten is the minimum number of lines OpenAI documents for a fine-tuning file.
{"messages":[{"role":"user","content":"What are your opening hours?"},{"role":"assistant","content":"We are open Monday to Friday, 9:00 to 17:30, and Saturday 10:00 to 14:00."}]}
{"messages":[{"role":"user","content":"Do you ship to Canada?"},{"role":"assistant","content":"Yes. Standard delivery to Canada takes 6 to 9 working days."}]}
{"messages":[{"role":"user","content":"How do I reset my password?"},{"role":"assistant","content":"Choose \"Forgot password\" on the sign-in page and follow the link we email you."}]}
{"messages":[{"role":"user","content":"Can I change my delivery address after ordering?"},{"role":"assistant","content":"Yes, until the order is marked as packed. Open the order and choose \"Edit address\"."}]}
{"messages":[{"role":"user","content":"Where is my invoice?"},{"role":"assistant","content":"Invoices are under Account > Billing. Each one can be downloaded as a PDF."}]}
{"messages":[{"role":"user","content":"Do you offer student discounts?"},{"role":"assistant","content":"Yes. Verified students get 20% off any annual plan."}]}
{"messages":[{"role":"user","content":"How do I cancel my subscription?"},{"role":"assistant","content":"Go to Account > Plan and choose \"Cancel plan\". Access continues until the end of the paid period."}]}
{"messages":[{"role":"user","content":"Is there a mobile app?"},{"role":"assistant","content":"Yes, for iOS and Android. Search for the product name in your app store."}]}
{"messages":[{"role":"user","content":"Can two people share one account?"},{"role":"assistant","content":"Each person needs their own seat. Team plans let you add seats at a lower price."}]}
{"messages":[{"role":"user","content":"What payment methods do you accept?"},{"role":"assistant","content":"We accept major credit and debit cards. Annual plans can also be paid by bank transfer."}]}
Batch API request file
Five requests in the layout OpenAI documents for batch input: a unique custom_id, a method, a url and a body. All five use the same model, as one batch file must.
{"custom_id":"review-1","method":"POST","url":"/v1/responses","body":{"model":"gpt-6-luna","input":"Classify the sentiment of: The checkout was quick and easy.","max_output_tokens":64}}
{"custom_id":"review-2","method":"POST","url":"/v1/responses","body":{"model":"gpt-6-luna","input":"Classify the sentiment of: My parcel arrived two weeks late.","max_output_tokens":64}}
{"custom_id":"review-3","method":"POST","url":"/v1/responses","body":{"model":"gpt-6-luna","input":"Classify the sentiment of: The colour is different from the photo.","max_output_tokens":64}}
{"custom_id":"review-4","method":"POST","url":"/v1/responses","body":{"model":"gpt-6-luna","input":"Classify the sentiment of: Support answered within five minutes.","max_output_tokens":64}}
{"custom_id":"review-5","method":"POST","url":"/v1/responses","body":{"model":"gpt-6-luna","input":"Classify the sentiment of: It works, nothing special.","max_output_tokens":64}}
Structured application logs
Twelve log entries with a timestamp, level, service and message, plus fields that change from line to line. One error carries a stack trace as a single string with escaped line breaks.
{"ts":"2026-06-10T08:00:01.120Z","level":"info","service":"api","msg":"Server started","port":8080}
{"ts":"2026-06-10T08:00:04.377Z","level":"info","service":"api","msg":"GET /health","status":200,"duration_ms":3,"request_id":"req-7f1a"}
{"ts":"2026-06-10T08:00:09.902Z","level":"info","service":"auth","msg":"User signed in","user_id":4,"request_id":"req-7f1b"}
{"ts":"2026-06-10T08:00:10.015Z","level":"debug","service":"db","msg":"Query executed","table":"orders","rows":12,"duration_ms":18}
{"ts":"2026-06-10T08:00:14.660Z","level":"warn","service":"api","msg":"Slow response","path":"/reports/monthly","duration_ms":2140,"request_id":"req-7f1c"}
{"ts":"2026-06-10T08:00:19.004Z","level":"info","service":"worker","msg":"Job queued","job":"export-csv","job_id":"job-0193"}
{"ts":"2026-06-10T08:00:21.731Z","level":"error","service":"worker","msg":"Job failed","job_id":"job-0193","error":"TimeoutError: upstream did not respond","stack":"TimeoutError: upstream did not respond\n at fetchReport (worker.js:88:11)\n at run (worker.js:41:5)"}
{"ts":"2026-06-10T08:00:22.050Z","level":"info","service":"worker","msg":"Job retried","job_id":"job-0193","attempt":2}
{"ts":"2026-06-10T08:00:27.418Z","level":"info","service":"api","msg":"POST /orders","status":201,"duration_ms":64,"request_id":"req-7f1d"}
{"ts":"2026-06-10T08:00:31.999Z","level":"warn","service":"auth","msg":"Too many attempts","ip":"203.0.113.24","attempts":5}
{"ts":"2026-06-10T08:00:40.203Z","level":"info","service":"worker","msg":"Job finished","job_id":"job-0193","duration_ms":18153}
{"ts":"2026-06-10T08:01:00.000Z","level":"info","service":"api","msg":"Heartbeat","uptime_s":59}
Non-English text, emoji and escape sequences
French, Japanese, Arabic and emoji written directly in UTF-8, the same kind of text written with \u escapes, and a string that contains an escaped line break, tab, quote and backslash.
{"lang":"fr","text":"Crème brûlée à la carte"}
{"lang":"ja","text":"東京は晴れです"}
{"lang":"ar","text":"مرحبا بالعالم"}
{"lang":"emoji","text":"Launch day 🚀 done ✅"}
{"lang":"escaped","text":"café written with a \\u escape, and a smile 😀 as a surrogate pair"}
{"lang":"controls","text":"Line one\nLine two\tTabbed, a \"quoted\" word and a back\\slash"}
Records whose keys and types change
Seven products that do not share one shape: missing keys, null values, an id that is a number on most lines and a string on one, and nested fields that appear part-way through. Use it to test schema detection.
{"id":101,"name":"Desk lamp","price":32.5}
{"id":102,"name":"Notebook","price":4.2,"tags":["paper","a5"]}
{"id":103,"name":"Monitor arm","price":null,"discontinued":true}
{"id":"104-B","name":"Cable set","price":12,"stock":{"warehouse":40,"shop":6}}
{"id":105,"price":18.75}
{"id":106,"name":"Standing mat","price":54,"tags":[],"stock":null}
{"id":107,"name":"Webcam","price":61.9,"specs":{"resolution":"1080p","fps":30},"tags":["video"]}
Windows line endings (CRLF)
The first five user records again, but each line ends with a carriage return and a line feed. Both specifications say a reader has to accept this.
{"id":1,"name":"Ada Mensah","email":"ada.mensah@example.com","plan":"free","active":true,"signed_up":"2026-01-14"}
{"id":2,"name":"Bruno Castell","email":"bruno.castell@example.com","plan":"pro","active":true,"signed_up":"2026-01-20"}
{"id":3,"name":"Chen Rui","email":"chen.rui@example.com","plan":"team","active":false,"signed_up":"2026-02-02"}
{"id":4,"name":"Dalia Haddad","email":"dalia.haddad@example.com","plan":"free","active":true,"signed_up":"2026-02-11"}
{"id":5,"name":"Emil Larsen","email":"emil.larsen@example.com","plan":"pro","active":true,"signed_up":"2026-03-05"}
Duplicate records for testing clean-up
Nine lines with repeats: one exact copy, one copy with its keys in a different order, one line that reuses an id with a different plan, and one record with no id at all.
{"id":1,"email":"ada.mensah@example.com","plan":"free"}
{"id":2,"email":"bruno.castell@example.com","plan":"pro"}
{"id":3,"email":"chen.rui@example.com","plan":"team"}
{"id":2,"email":"bruno.castell@example.com","plan":"pro"}
{"plan":"team","email":"chen.rui@example.com","id":3}
{"id":4,"email":"dalia.haddad@example.com","plan":"free"}
{"id":1,"email":"ada.mensah@example.com","plan":"pro"}
{"id":5,"email":"emil.larsen@example.com","plan":"pro"}
{"email":"no-id@example.com","plan":"free"}
Invalid on purpose: five common mistakes
Lines 1 and 10 are fine. Lines 2 to 9 fail: a trailing comma, single quotes, a blank line, one object spread over four lines, and an unquoted key. A line-by-line reader should accept two lines and report eight.
{"id": 1, "status": "ok"}
{"id": 2, "status": "trailing comma",}
{'id': 3, 'status': 'single quotes'}
{
"id": 5,
"status": "pretty-printed across three lines"
}
{id: 9, "status": "unquoted key"}
{"id": 10, "status": "ok"}
Download by Size (10KB - 1MB)
Need a practical file size for load testing? Download generated dummy files near the selected size. Container formats such as XLSX and DOCX may vary slightly because of compression.
10 KB
Small sample for basic testing
100 KB
Medium sample for throughput testing
1 MB
Large sample for benchmark testing
The three rules every JSON Lines file follows
The whole format fits on one page at jsonlines.org . It has three requirements.
- The file is UTF-8. A byte order mark at the start is not allowed. Text outside ASCII can be written directly or with
\uescapes; the Unicode sample does both. - Each line is one valid JSON value. Any value is permitted, so
nullon a line is fine, while an empty line is not. - Lines end with a line feed. A carriage return before it is also accepted, because white space around a JSON value is ignored. A line ending after the last record is recommended and not required.
One consequence matters more than the rules themselves: a record can never contain a raw line break. A line break inside a string has to be written as \n, as the stack trace in the logs sample shows.
The same three records as a JSON array and as JSON Lines
A JSON array wraps the records in brackets and separates them with commas:
[
{"id": 1, "name": "Ada Mensah"},
{"id": 2, "name": "Bruno Castell"},
{"id": 3, "name": "Chen Rui"}
]JSON Lines drops the brackets and the commas and gives each record its own line:
{"id": 1, "name": "Ada Mensah"}
{"id": 2, "name": "Bruno Castell"}
{"id": 3, "name": "Chen Rui"}The difference looks small and changes how the file behaves.
- Appending: a new record is added to a JSON Lines file by writing one more line. An array has to be reopened to place the record before the closing bracket.
- Reading: a program can process a JSON Lines file one line at a time, so memory use stays flat for a file of any size. An array is normally parsed as a whole.
- Damage: one bad line costs one record. One bad character in an array makes the whole file unreadable to a standard parser.
- Validity: a JSON Lines file is not itself a JSON document. Pasting it into a JSON validator reports an error after the first line.
To move between the two, use the JSONL to JSON converter or the JSON to JSONL converter.
Why each line of the invalid sample fails
The last sample has ten lines. A reader that works line by line should accept two of them and reject eight. These are the mistakes behind most "my JSONL won't load" reports.
| Line | Content | Result |
|---|---|---|
| 1 | {"id": 1, "status": "ok"} | Valid. |
| 2 | {"id": 2, "status": "trailing comma",} | Fails. JSON does not allow a comma after the last item. |
| 3 | {'id': 3, 'status': 'single quotes'} | Fails. Keys and strings need double quotes. |
| 4 | (empty) | Fails under JSON Lines, where a blank line is not a value. Some NDJSON readers skip it. |
| 5 to 8 | { "id": 5, ... } over four lines | All four fail. The object is correct JSON, but no single line of it is complete. |
| 9 | {id: 9, "status": "unquoted key"} | Fails. This is JavaScript object syntax, not JSON. |
| 10 | {"id": 10, "status": "ok"} | Valid. |
Load it into the JSONL merger to see the failing lines listed by number, or into your own code to check that one bad line does not stop the rest of the file from loading.
What the two OpenAI samples are for
Two of the files follow layouts that OpenAI documents for its API. They are here so you can test code that builds or checks such files before you upload a real one.
Fine-tuning examples
A fine-tuning file has one complete JSON structure per line. Each line holds a messages array with a user prompt and the assistant reply the model should learn. The fine-tuning guide sets the minimum at 10 lines and suggests starting with 50.
Batch requests
A batch input file has one API request per line with four fields: a custom_id that is unique in the file, a method, a url naming the endpoint, and a body with that endpoint's parameters. Results can come back in a different order, which is why each request needs its own id. The Batch guide limits a batch to 50,000 requests and a 200 MB file, and requires every request in a file to use the same model.
The model name in the batch sample is the one used in OpenAI's own example. Replace it with the model you use before sending anything.
JSON Lines and NDJSON side by side
The two names describe the same idea, written down in two places: JSON Lines and the NDJSON specification . The values on each line are ordinary JSON as defined in RFC 8259 .
| JSON Lines | NDJSON | |
|---|---|---|
| File extension | .jsonl | .ndjson |
| Media type | application/jsonl, not yet standardised | application/x-ndjson |
| Encoding | UTF-8, no byte order mark | UTF-8 |
| Line ending | Line feed; CRLF also works | Line feed; parsers must also accept CRLF |
| Empty lines | Not a valid value | A parser may ignore them if it documents that |
| Line breaks inside a record | Not possible; one value per line | Not allowed |
| Ending after the last record | Recommended, not required | Each record is followed by a line feed |
| Compressed files | .jsonl.gz or .jsonl.bz2 | Not covered |
Read a file one line at a time in Python and Node.js
Neither language needs an extra package. Both snippets were run against the samples named in them.
Python: loop over the nested orders
import json
with open("sample-nested-orders.jsonl", encoding="utf-8") as f:
for number, line in enumerate(f, start=1):
order = json.loads(line)
print(number, order["order_id"], len(order["items"]), "items")It prints five lines, from order A-1001 with two items to A-1005 with one. Order A-1003 shows zero items.
Node.js: keep going when a line is bad
const fs = require("fs");
const readline = require("readline");
async function main() {
const reader = readline.createInterface({
input: fs.createReadStream("sample-invalid-lines.jsonl"),
crlfDelay: Infinity,
});
let number = 0;
let good = 0;
for await (const line of reader) {
number += 1;
try {
JSON.parse(line);
good += 1;
} catch (error) {
const reason = line.trim() === "" ? "blank line" : error.message;
console.log("line " + number + " failed: " + reason);
}
}
console.log(good + " of " + number + " lines are valid");
}
main();Run on the invalid sample, it reports eight failed lines by number and ends with "2 of 10 lines are valid". The same loop is the right shape for real data: catch the error, record the line number, carry on.
JSONL questions, answered from the specifications
What is a JSONL file?
A JSONL file, short for JSON Lines, is a UTF-8 text file with one complete JSON value on each line. Most files hold one object per line. Because every line stands alone, a program can read, write or skip records one at a time without loading the whole file.
Is JSONL the same as NDJSON?
In practice, yes. Both put one JSON value on each line, and a file that follows one almost always works as the other. They are two separate specifications that differ on small points: NDJSON suggests the .ndjson extension and the application/x-ndjson media type, and lets a parser skip empty lines if it documents that.
Can a line hold an array or a plain string and not an object?
Yes. The JSON Lines specification allows any JSON value on a line: an object, an array, a string, a number, true, false or null. Objects and arrays are the most common. The mixed-values sample has one line of each kind.
Are blank lines or comments allowed in a JSONL file?
No. JSON has no comment syntax, and the JSON Lines specification says a blank line is not a valid value. Some NDJSON parsers can be set to skip empty lines, so a file with blank lines may load in one tool and fail in another.
Why does my JSONL file fail to parse?
The usual cause is a file that was pretty-printed, so each record covers several lines. Other common causes are a trailing comma, single quotes, an unquoted key, a blank line, or a byte order mark at the start of the file. The invalid sample on this page contains five of these.
How many lines does an OpenAI fine-tuning file need?
OpenAI's fine-tuning guide says the file must have at least 10 lines, one training example per line, and recommends starting with 50 well-made examples. The fine-tuning sample here has exactly 10.
How do I open a JSONL file?
Any text editor opens it, since it is plain text. For a large file, or to see records as a table and search them, use a viewer made for the format, such as the JSONL viewer on this site, which reads the file in your browser.
How do I turn a JSON array into JSONL?
Write each element of the array on its own line as compact JSON, with no commas between lines and no surrounding brackets. The JSON to JSONL converter on this site does this in the browser, and the JSONL to JSON converter does the reverse.
Tools on this site that work with these files
- JSONL merger: join several files, list invalid lines and remove duplicates. Try it with the duplicate-records sample.
- JSONL viewer: browse and search records, including the 1 MB download.
- JSONL to JSON and JSON to JSONL: convert in either direction.
- Sample JSON files when you need a single JSON document, or all sample files.