Shard Tools

JSONL to JSON

Turn JSON Lines into a single formatted JSON array in your browser.

Maintained by Roshan.

Use JSONL to JSON

Converts JSON Lines into JSON array in this tab. Configuration files routinely hold hostnames, keys and credentials, so nothing here is sent anywhere.

Values are never retyped as numbers or booleansGuessing types is how a converter turns a postcode of 0123 into 123, or a literal string of false into a boolean. Values are carried across as they were written, and casting is left to you where it matters.

Explore developer and data tools

Find related browser-local tools for nearby tasks without starting another search.

Browse all developer and data tools

About JSONL to JSON

Reading a JSON Lines file by eye is unpleasant. Each record is compact by necessity, which means one long unbroken line per entry, and finding the record you care about among thousands of them is genuinely difficult. Converting to a formatted array makes it readable and lets ordinary JSON tooling work on it. The feature that matters most here is not the conversion itself but the error handling. A JSONL file is usually machine-generated, often by something that was appending to it while a process crashed, and a single truncated record in the middle of a large file will break any parser. A generic error saying the JSON is invalid is nearly useless in that situation. This one names the line number and shows the start of the offending record.

Work through the input

  1. Each non-empty line is parsed as an independent JSON value and collected into an array.
  2. Blank lines are skipped rather than treated as errors, since trailing newlines and gaps are common in appended files.
  3. If a line fails to parse, the error names its line number and shows the beginning of the text, which is the difference between a two-second fix and a long search.
  4. The result is written as a formatted array with indentation, which is what makes the data readable again.
  5. Record order is preserved exactly, since in log and event data the order is usually meaningful.

When jsonl to json is useful

Inspecting a log export

Convert and the records become readable. If the file was truncated by a crash, the error tells you exactly which line to remove.

Loading a dataset into a tool that wants an array

Many editors and viewers expect standard JSON. This is the bridge.

Check the output

Questions about JSONL to JSON

What happens if one record is broken?

The conversion stops and names the line number, showing the start of that record. Finding one bad line in ten thousand is otherwise very hard.

Are blank lines a problem?

No. They are skipped, since trailing and intervening blank lines are common in files written by appending.

Is the order preserved?

Yes, exactly. For logs and event streams the order usually carries meaning.

Can records have different structures?

Yes. JSONL allows it and the array simply contains different shapes.

Related tools

JSON to JSONL

Turn a JSON array into JSON Lines in your browser, one record per line, ready for streaming tools.

JSON Formatter and Validator

Format, minify, and validate JSON locally in your browser. Inspect keys, values, nesting depth, and root type without sending private API data to a server.

CSV to JSON Converter

Convert CSV to a JSON array locally. Parse quoted commas, embedded newlines, BOM files, duplicate headers, sparse rows, and optional safe value types.