JSON Formatter

Paste messy or minified JSON and get it back pretty-printed with 2-space indentation. The same step tells you whether the JSON is valid.

Updated

Developer ToolsPopularHot● Free No upload Instant

Loading JSON Formatter…

Your browser is preparing the tool. It runs 100% locally.

Quick answer

JSON Formatter takes messy or minified JSON and pretty-prints it with clean 2-space indentation. It parses the JSON and writes it back out, so it validates while it formats: valid input comes back tidy, and invalid input shows the parser's error. Your browser does the work and the data stays in the page.

  • 2 spacesindentation
  • StrictRFC 8259 parser
  • Yesvalidates as it formats
  • 0uploads

What the JSON Formatter does

JSON that arrives on one long line, or with uneven spacing, is hard to read and harder to debug. Paste it here and it comes back indented, with each key and nested level on its own line, so you can see the structure at a glance.

The tool parses your text into real data and prints it back, so formatting also checks validity: invalid JSON gives you an error, not a half-tidied mess. Valid output is ready to copy straight back into your code.

How it works

The browser's built-in JSON engine parses your text into a real data structure. This step follows the JSON standard exactly, so it rejects comments, trailing commas, single quotes and unquoted keys.

The tool then writes that structure back out as text with two-space indentation. Only whitespace is added, so the data itself is unchanged and every object, array and value is easy to follow.

Before and after

before (minified){"id":7,"tags":["a","b"]}after (2-space indent){"id": 7,"tags": ["a","b"]}
Only whitespace is added. Keys, their order and the values stay as they were.

Processing pipeline

  1. Step 1. Paste your JSON. It stays in your browser and is not uploaded.
  2. Step 2. The text is parsed into a value, which is where invalid JSON is caught.
  3. Step 3. The value is written back out with 2-space indentation, one key or item per line.
  4. Step 4. Valid input shows the tidy output plus a Valid JSON note; invalid input shows the parser's error.
  5. Step 5. Copy the formatted result back into your editor.

Privacy

Your device parses and formats the JSON, and it is never uploaded to NineClip or anyone else. That matters when the data is a real API payload, a config file, or anything with tokens or personal details in it.

There is no account and the tool stores nothing. Clear the box or close the tab and your input and the formatted output are both gone from memory.

Technical details

Indentation2 spaces
EngineBrowser JSON parser (strict)
ValidatesYes; invalid JSON shows an error
AcceptsStandard JSON only (no comments/trailing commas)
OutputPretty-printed, ready to copy
UploadNone; the JSON is formatted in your browser

Standards and references

  • ECMA-404 / RFC 8259 (JSON): the JSON standards the parser enforces. The two are meant to define the same syntax.
  • Strict JSON: standard JSON forbids comments, trailing commas, single-quoted strings and unquoted keys, and the parser rejects all of them by design.

Accuracy and limits

Formatting keeps the structure intact. Keys stay in their order and values are unchanged, because only whitespace is added.

Numbers and keys have two quirks. Numbers are parsed as standard floating point, so an integer beyond about 9 quadrillion (2⁵³) can lose its exact value, and forms like 1e3 or 1.0 are printed back as 1000 and 1. If an object has duplicate keys, JSON keeps the last one and the earlier copies disappear.

The parser is strict. Comments, trailing commas, single quotes and unquoted keys are not valid JSON and trigger an error, so if your file uses them (JSON5 or JavaScript-object style), clean them up first.

Error messages come from the browser's JSON parser, so the wording and the position it points to vary by browser. The message tells you something is wrong and roughly where, though not always why.

What the strict parser rejects

// commentstrailing comma[1,2,]'single quotes'unquoted key{id: 1}{"id": 1}
These work in JavaScript or JSON5 but not in JSON. Remove them, then format again.

Real-world uses

Read an API response

Paste a minified response and see its structure laid out with indentation.

Debug a payload

Spot a misplaced bracket or missing comma by formatting the payload and reading the layout.

Tidy before committing

Bring a config or data file to consistent 2-space indentation.

Quick validity check

Confirm a snippet is valid JSON: if it formats, it is valid.

When it fits, and when it doesn't

Good for

  • Pretty-printing minified or messy JSON
  • A fast validity check while formatting
  • Reading API responses and config files
  • Consistent 2-space indentation

Not the best choice for

  • JSON5 or JS objects (comments, trailing commas)
  • Preserving huge integers exactly (precision limit)
  • Choosing tab or 4-space indentation
  • Keeping duplicate keys

If you only need a yes or no with the error, use the JSON validator. To make the JSON small again, use a JSON minifier. For relaxed syntax, convert from JSON5 first.

Tips and tricks

What we would do

Frequently asked questions

What indentation does it use?
Two spaces on every nested level. The setting is fixed, so the output always uses 2-space indentation.
Does it validate as well as format?
Yes. It parses your JSON before formatting, so invalid input produces an error instead of output. If it formats cleanly, your JSON is valid.
Why will my JSON with comments not format?
Standard JSON does not allow comments, trailing commas, single quotes or unquoted keys. Those belong to JSON5 or JavaScript objects. Remove them and the JSON will format.
Will it change my numbers?
It can normalise them: 1e3 becomes 1000 and 1.0 becomes 1, because numbers are parsed and printed again. Integers larger than about 2⁵³ can also lose precision, since JSON numbers are floating point.
What happens to duplicate keys?
JSON keeps only the last value for a repeated key, so earlier duplicates are dropped during formatting. Every standard JSON parser does this.
Does formatting reorder my keys?
No. Keys stay in the order they appear in your input. The tool adds indentation and line breaks and does not sort.
Is my JSON uploaded anywhere?
No. Your browser parses and formats it and sends nothing to a server. Clearing the box removes it.
Can I get it back on one line?
Not with this tool, which only expands JSON. To compress it again, use a JSON minifier, which strips the whitespace back out.
Why is the error message vague?
The error comes from the browser's JSON parser. It reports that parsing failed and roughly where, and the wording differs between browsers, so look near the position it mentions.
Is there a size limit?
There is no fixed limit. Very large JSON depends on your device's memory, since the browser does the work, but typical files format instantly.

References

This page describes what the formatter does: a strict parse and a 2-space re-print. Large integers past 2⁵³ can lose precision and duplicate keys collapse to the last one, which is standard JSON behaviour.

Popular

Base64 Encoder

Encode any text to standard Base64 in your browser, emoji and accented letters included.

DeveloperOpen Tool
Popular

Hash Generator

Get the MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text at once, updated as you type, with a plain note on which ones are still safe for security work.

DeveloperOpen Tool
Popular

UUID Generator

Generate up to 500 random version 4 UUIDs at once, the 128-bit identifiers used for database keys, from your browser's secure random generator.

DeveloperOpen Tool

Base64 Decoder

Decode Base64 back to readable text in your browser, Unicode included, and get a plain error message when the input is broken.

DeveloperOpen Tool

URL Encoder

Percent-encode a value so it can sit safely inside a URL. Spaces, ampersands, slashes and other special characters become %-codes, using the browser's encodeURIComponent.

DeveloperOpen Tool

URL Decoder

Turn percent-encoded text back into readable characters: %20 becomes a space and %26 an ampersand. It uses the browser's decodeURIComponent.

DeveloperOpen Tool

Back to the JSON Formatter

Your file is processed on this device and never uploaded, and there's no account to create.