Skip to main content

Convert JSONL to JSON and JSON to JSONL

Convert JSONL or NDJSON records into a JSON array and back while preserving the original spelling of numbers.

  • Clipboard
  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Paste data or import a UTF-8 file. Limits: 2 million input characters, 100,000 records and 4 million output characters.

Was this tool useful?

On this page

How does this tool work?

Log exports, document collections and datasets often contain one JSON value per line rather than a single array. This converter gathers JSONL or NDJSON records into a JSON array, or splits an array back into records. It preserves their order, nested structures and numeric spelling. Use it to prepare a small export for software that expects a complete JSON document.

In JSONL to JSON mode, every physical line must contain a complete JSON value: an object, array, string, number, boolean or null. There are no commas between lines and no square brackets around the whole file. A value spread across several physical lines is rejected. Use the escaped sequence \n for a newline within a string. Both LF and CRLF endings are accepted; one terminal newline closes the last record without creating another.

For the reverse conversion, supply a JSON array. Each element becomes one compact line, including nested objects and arrays. A single object is rejected: wrap it in square brackets only if you intend an array containing that object. The converter does not sort records, remove duplicates or turn fields into columns. Use a CSV or spreadsheet converter for tabular data.

The engine validates JSON syntax, then copies original tokens instead of serializing JavaScript numbers. Consequently 9007199254740993, 0.1234567890123456789, 1e400 and -0 retain their spelling. Escaped strings and duplicate property names are retained too. This preserves the written document, but downstream software may apply its own numeric precision limits or overwrite duplicate properties.

An invalid line stops the entire conversion and reports its original line number. No partial result is offered for download. Blank lines are rejected by default; enable skipping only when they do not represent meaningful records. Empty input, or blank lines explicitly skipped, produces []. In the other direction, [] produces a zero-byte JSONL file with a record count of zero.

File import reads UTF-8 locally. An initial BOM is tolerated and removed, although JSON Lines does not allow it. Export uses LF endings and appends a newline after each JSONL record. Limits are measured in UTF-16 code units: 2 million input units, 4 million output units, 100,000 records and 128 nesting levels. This is a bounded in-memory conversion, rather than streaming for arbitrarily large files.

Conversion runs in a cancellable Worker with a five-second deadline. If it times out, divide the export between complete records, never through a value. Editing the input or an option removes the previous result. Keep the original file and check the record count before using the download in another system.

How to use this tool

  1. Choose a direction

    Select JSONL to JSON or JSON to JSONL before converting.

  2. Prepare the input

    Paste data or import a .json, .jsonl or .ndjson file; check for blank lines.

  3. Check and export

    Review the count and output, then copy or download the result.

Use cases

Open a log in a JSON reader

Gather events written one per line into a single array without changing their chronological order.

Prepare a line-based dataset

Turn a JSON array into independent records for a process that expects JSONL or NDJSON input.

Transfer long numeric identifiers

Retain the original identifier digits and decimal tokens before passing the document to another application.

Examples

Two identifiers without rounding

Two lines become two array elements. The large integer keeps every original digit.

Input

{"id":9007199254740993}
{"id":2}

Result

[
  {"id":9007199254740993},
  {"id":2}
]

Tips and best practices

  • Check the direction before importing pretty-printed JSON.
  • One object per line suits logs; a JSON array suits many APIs.
  • Use the JSON flattener afterwards if you need nested fields as columns.

Sources and references

Frequently asked questions

Are JSONL and NDJSON different formats?

Both names mean one JSON value per line here. Files ending in .jsonl and .ndjson follow the same conversion rules.

Why is my valid JSON rejected?

JSON to JSONL requires an array at the root. JSONL to JSON requires each value to fit on one physical line.

Does this validate a JSON Schema?

No. Syntax is checked without enforcing field types or business rules. Use the JSON Schema validator for those constraints.

Related tools

Tools similar or complementary to this one.

Similar tools

Format, minify, and validate JSON to make it easier to read or more compact.

Data & spreadsheetsFeaturedUse this tool

Turn nested JSON objects into explicit path columns ready for tabular use.

Data & spreadsheetsUse this tool
GuideBest practicesIntermediate

Build a reproducible data-preparation workflow

Put cleaning, validation, filtering, merging, comparison and conversion in a sensible order, and learn when a reusable pipeline is better than isolated tools.

29 August 20262 min