Xerobit

JSON to JSONL Converter

Paste a JSON array to convert it into JSONL (JSON Lines) format, where each element appears on its own line. The converter handles nested objects, arrays, null values and Unicode while keeping keys in a stable order. It runs entirely in the browser so nothing is uploaded.

A valid JSON array or a single JSON value.

JSONL Output

{"age":30,"name":"Alice"}
{"age":25,"name":"Bob"}

How to use the json to jsonl converter

  1. Paste your JSON array into the input field.
  2. The tool automatically parses the JSON and converts each element to a single line.
  3. Copy the resulting JSONL text for use in data pipelines, log files or bulk imports.

What is JSONL?

JSONL stands for JSON Lines, also known as newline-delimited JSON or NDJSON. In this format each line is a separate, valid JSON value. Unlike a standard JSON array that wraps everything in brackets and separates items with commas, JSONL places exactly one value per line with no surrounding structure.

This makes it ideal for streaming, appending to log files and processing large datasets line by line without loading the entire file into memory. Many data tools, databases and machine learning frameworks accept JSONL natively.

How the conversion works

The converter first parses your input using the built-in JSON.parse function. If the result is an array, each element is processed individually. If it is a single value such as an object, string or number, it is treated as a one-line document.

To ensure deterministic output, all object keys are sorted alphabetically at every nesting level before serialization. For example, the input [{"b":2,"a":1}] produces {"a":1,"b":2}. Nested objects like {"z":1,"a":{"c":3,"b":2}} become {"a":{"b":2,"c":3},"z":1}.

Each processed value is then serialized back to a compact JSON string using JSON.stringify and joined with newline characters. No extra whitespace or pretty-printing is added, keeping the output suitable for machine consumption.

Common values reference

The table below shows how different JSON structures appear after conversion to JSONL.

JSON inputJSONL output
[{"b":2,"a":1}]{"a":1,"b":2}
[1, 2, 3]1
2
3
[null, false, "hi"]null
false
"hi"
[](empty)
{"x":1}{"x":1}

Handling edge cases

Several edge cases require attention when converting JSON to JSONL:

  • Empty arrays produce no output lines, which is correct since there are zero elements.
  • Non-array input such as a plain object or primitive is accepted and emitted as a single line.
  • Unicode characters including emoji and accented letters are preserved exactly as they appear in the source.
  • Null values inside arrays become the literal string null on their own line.
  • Newlines inside strings are escaped by JSON.stringify as \n, ensuring each logical record stays on one physical line.

If you need to fix malformed JSON before converting, use a JSON fixer first. To inspect the structure visually, try the JSON viewer.

Worked examples

ExampleInputResult
Array of usersJSON input: [{"name":"Alice","age":30},{"name":"Bob","age":25}]{"age":30,"name":"Alice"} / {"age":25,"name":"Bob"}
Nested objectsJSON input: [{"id":1,"meta":{"tags":["a","b"],"active":true}},{"id":2,"meta":null}]{"id":1,"meta":{"active":true,"tags":["a","b"]}} / {"id":2,"meta":null}
Unicode stringsJSON input: [{"emoji":"🚀","text":"café"}]{"emoji":"🚀","text":"café"}

FAQ

What is the difference between JSON and JSONL?

JSON typically represents a single document, often an array of objects wrapped in brackets. JSONL places one complete JSON value per line with no outer array or commas between lines, making it easier to stream and append.

Does this converter handle nested objects?

Yes. Nested objects and arrays are fully supported. Keys at every level are sorted alphabetically to produce deterministic, reproducible output.

Can I convert a single JSON object instead of an array?

Yes. If you paste a single object or primitive value rather than an array, the tool outputs it as one JSONL line.

Is my data sent to a server?

No. Parsing and conversion happen entirely in your browser using JavaScript. Nothing is uploaded anywhere.

What happens if my JSON is invalid?

The tool displays the exact error message from the JSON parser so you can locate and fix the syntax issue. You can also use a JSON fixer tool to repair common mistakes.

Are Unicode characters preserved?

Yes. Emoji, accented characters and other Unicode symbols pass through unchanged because the underlying JSON parser handles them natively.

What is NDJSON?

NDJSON stands for Newline Delimited JSON. It is another name for JSONL and follows the same specification of one JSON value per line.