JSON → JSONL Converter
Convert JSON arrays to JSONL (JSON Lines) format: one object per line: commonly used for LLM fine-tuning datasets. Supports format presets for OpenAI and Anthropic.
Fine-Tuning Preset
Wraps as {"messages": [{"role": "user", ...}, {"role": "assistant", ...}]}
{"messages":[{"role":"user","content":"What is the capital of France?"},{"role":"assistant","content":"The capital of France is Paris."}]}
{"messages":[{"role":"user","content":"Explain photosynthesis briefly."},{"role":"assistant","content":"Photosynthesis is the process by which plants convert sunlight, water, and CO2 into glucose and oxygen."}]}
{"messages":[{"role":"user","content":"What is 7 times 8?"},{"role":"assistant","content":"7 times 8 equals 56."}]}What is JSONL?
JSONL (JSON Lines) stores one JSON object per line with no separating commas or enclosing brackets. It is the standard format for LLM fine-tuning datasets because it can be streamed line-by-line without loading the entire file into memory. Token estimate uses a rough heuristic of 1 token ≈ 4 characters.
Convert JSON to JSONL online for LLM fine-tuning datasets
When preparing fine-tuning data for language models, JSONL is the universal standard. Most frameworks: OpenAI, Anthropic, Hugging Face, Axolotl, LLaMA-Factory: expect training data as one JSON object per line rather than a large JSON array. This converter handles that transformation instantly and also provides the correct wrapping structure for the most common fine-tuning APIs.
The preset system saves you from manually reformatting every record. Select the OpenAI Chat preset and every object in your array will be wrapped in the messages format with user and assistant roles automatically inferred from common field names (user, input, prompt, question for the user turn; assistant, output, completion, answer for the assistant turn).
How to use: step by step
- 1Paste your JSON array
Input must be a valid JSON array: a list of objects enclosed in square brackets, e.g. [{...}, {...}]. Use 'Load sample' to see the expected format. - 2Choose a fine-tuning preset
Select Raw for plain JSONL, OpenAI Chat for the messages format, OpenAI Completion for the prompt/completion format, or Anthropic for the human/assistant format. - 3Review the JSONL output
Each JSON object becomes one line in the output. The panel shows line count, estimated token count, and character count. - 4Download or copy the result
Click Download to save a .jsonl file or Copy to send the output to your clipboard. - 5Switch modes if needed
Toggle to JSONL → JSON to reverse the process and convert a JSONL file back to a readable JSON array.
Related Tools
AI Detector
Analyze text for AI-generated patterns using heuristic scoring: sentence uniformity, vocabulary richness, formal phrasing, and more.
Token Counter
Count tokens for GPT-4, Claude, Llama, and Gemini models. See context window usage, cost estimates, and character/word stats.
Prompt Builder
Compose structured prompts with system message, user turn, few-shot examples, and output format. Export as JSON or plain text.
Readability Analyzer
Score text with Flesch Reading Ease, Flesch-Kincaid Grade, Gunning Fog, and SMOG. Get detailed stats on sentences, words, and syllables.
Frequently Asked Questions
- What is JSONL (JSON Lines)?
- JSONL is a text format where each line is a valid, self-contained JSON object. Unlike a regular JSON array, JSONL files can be read and processed one line at a time without loading the entire file into memory. It is the standard input format for fine-tuning LLMs on OpenAI, Anthropic, and most open-source platforms.
- What is the difference between JSONL and NDJSON?
- They are functionally identical. NDJSON stands for Newline Delimited JSON and is just an alternative name for the same format. Both refer to files where each line is a standalone JSON object.
- What format does OpenAI's fine-tuning API expect?
- For chat models, OpenAI expects each line to be a JSON object with a 'messages' array containing role/content pairs. The OpenAI Chat preset in this tool generates exactly that format.
- Can I convert JSONL back to JSON?
- Yes. Switch to the JSONL → JSON mode and paste your JSONL content. The tool will parse each line and wrap all objects into a JSON array.
- How accurate is the token estimate?
- The token estimate uses a rough heuristic of 1 token per 4 characters. Actual token counts vary by model and tokenizer: use this as a ballpark figure for planning dataset sizes.
- Does my data leave my device?
- No. All conversion logic runs in your browser. Your data is never uploaded to any server.
- Is there a file size limit?
- There is no enforced limit, but very large JSON arrays (millions of records) may be slow to process in the browser. For large datasets, a command-line tool like jq is recommended.
- What happens if my JSON is invalid?
- The tool shows a clear error message identifying the problem. It will not produce any output until the JSON is valid.
- Can I use this for Llama or open-source model fine-tuning?
- Yes. Most open-source fine-tuning frameworks accept standard JSONL or the Alpaca format. Use the Raw preset and structure your objects to match the expected schema for your framework.
AlteredIdea vs alternatives
vs ChatGPT / Claude: Those are general-purpose AI assistants. AlteredIdea provides purpose-built, instant tools: no prompting needed.
vs paid SaaS tools: No subscription, no API key required, works instantly in your browser.
vs browser extensions: No installation, no browser permissions, works on any device.