Skip to the tool

JSON formatter

Paste JSON and get it pretty printed with syntax colours, a collapsible tree view and exact error positions when it does not parse.

Guide

How to use it

  1. Paste your JSON. Parsing happens as you type, locally.
  2. If it is invalid, the status line gives the line, column and the likely cause. Fix and it re-parses instantly.
  3. Pick an indent (2 spaces, 4 spaces or tabs) or switch to Tree to fold and unfold nested structures.
  4. Copy the output or download it as a .json file.
  5. Need it small instead? The minifier strips every byte of whitespace.

Examples

Worked examples

A one-line API response

Paste the wall of text from a curl call, pick 2 spaces and the structure appears: keys in blue, strings in green, numbers in amber. The tree view folds a 300-item array to one line.

The trailing comma

A config file fails with invalid at line 12, column 3 and the hint names a trailing comma before a closing bracket, the single most common JSON mistake.

Copied from JavaScript

An object pasted from code fails because keys are unquoted and strings use single quotes. Both are flagged; valid JSON needs double quotes on every key and string.

Method

How it works

Your text goes through the browser's native JSON.parse, the same parser every JavaScript application uses, so valid here means valid everywhere. Formatting is JSON.stringify with your chosen indent, which changes whitespace and nothing else. Error positions come from the parser itself, with a heuristic pass that names common causes like trailing commas and single quotes.

Everything stays in the page: no upload, no history, nothing retained after you close the tab. That matters when the JSON is a production payload.

FAQ

Frequently asked questions

Is it safe to paste production API responses here?

The JSON is parsed by your own browser with JavaScript's built-in JSON.parse and never leaves your device. You can load the page, go offline and it works identically.

Why is my JSON invalid when it works in JavaScript?

JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. JSON allows none of those. The validator names which of these it spotted.

What indent should I use?

Two spaces is the common convention for JSON in repositories and docs. Use minified output for anything a machine reads, the whitespace is pure transfer weight.

Does formatting change my data?

Only whitespace changes. Keys, values and their order are preserved exactly as parsed. One caveat inherited from JavaScript: numbers beyond 15-16 significant digits lose precision, so format documents with 64-bit IDs carefully.

How large a file can it handle?

A few megabytes formats instantly. Above roughly 5 MB the browser tab may pause for a moment; syntax colouring switches off on very large output to keep things responsive.

Can it convert JSON to CSV?

Yes, the JSON to CSV page converts an array of objects into rows with dot-notation columns for nested keys.

More tools

Related tools

JSON validatorJust the verdict: valid or the exact error and why. JSON to CSVTurn an array of objects into spreadsheet rows. Diff checkerCompare two JSON payloads after formatting them. Base64 decodeUnwrap encoded payloads before formatting them.
Skip to the tool

JSON formatter

Paste JSON and get it pretty printed with syntax colours, a collapsible tree view and exact error positions when it does not parse.

Paste JSON to check it.

Everything runs in your browser. Nothing you paste is sent to a server.

Guide

How to use it

  1. Paste your JSON. Parsing happens as you type, locally.
  2. If it is invalid, the status line gives the line, column and the likely cause. Fix and it re-parses instantly.
  3. Pick an indent (2 spaces, 4 spaces or tabs) or switch to Tree to fold and unfold nested structures.
  4. Copy the output or download it as a .json file.
  5. Need it small instead? The minifier strips every byte of whitespace.

Examples

Worked examples

A one-line API response

Paste the wall of text from a curl call, pick 2 spaces and the structure appears: keys in blue, strings in green, numbers in amber. The tree view folds a 300-item array to one line.

The trailing comma

A config file fails with invalid at line 12, column 3 and the hint names a trailing comma before a closing bracket, the single most common JSON mistake.

Copied from JavaScript

An object pasted from code fails because keys are unquoted and strings use single quotes. Both are flagged; valid JSON needs double quotes on every key and string.

Method

How it works

Your text goes through the browser's native JSON.parse, the same parser every JavaScript application uses, so valid here means valid everywhere. Formatting is JSON.stringify with your chosen indent, which changes whitespace and nothing else. Error positions come from the parser itself, with a heuristic pass that names common causes like trailing commas and single quotes.

Everything stays in the page: no upload, no history, nothing retained after you close the tab. That matters when the JSON is a production payload.

FAQ

Frequently asked questions

Is it safe to paste production API responses here?

The JSON is parsed by your own browser with JavaScript's built-in JSON.parse and never leaves your device. You can load the page, go offline and it works identically.

Why is my JSON invalid when it works in JavaScript?

JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. JSON allows none of those. The validator names which of these it spotted.

What indent should I use?

Two spaces is the common convention for JSON in repositories and docs. Use minified output for anything a machine reads, the whitespace is pure transfer weight.

Does formatting change my data?

Only whitespace changes. Keys, values and their order are preserved exactly as parsed. One caveat inherited from JavaScript: numbers beyond 15-16 significant digits lose precision, so format documents with 64-bit IDs carefully.

How large a file can it handle?

A few megabytes formats instantly. Above roughly 5 MB the browser tab may pause for a moment; syntax colouring switches off on very large output to keep things responsive.

Can it convert JSON to CSV?

Yes, the JSON to CSV page converts an array of objects into rows with dot-notation columns for nested keys.

More tools

Related tools