JSON Formatter

Format, minify, validate, and explore JSON with a collapsible tree view, colorized syntax, and detailed stats — all local to your browser.

Loading tool…

What is JSON?

JSON stands for JavaScript Object Notation. It is a text format for structured data, invented by Douglas Crockford in the early 2000s and now the default way software exchanges information over the web. Its entire grammar fits on one page: objects in curly braces holding key–value pairs, arrays in square brackets, and four primitive types — string, number, boolean, and null. That deliberate smallness is why every language from Python to Java to Go can read it, and why almost every API you touch speaks it.

Because JSON ignores whitespace, the same document can be one unbroken 40 KB line or a neatly indented tree. Servers send the compact version to save bandwidth; humans need the indented version to read anything at all. Formatting — also called pretty-printing or beautifying — parses the text into a real data structure and re-serialises it with consistent indentation and line breaks, which also proves the document is syntactically valid along the way.

Why we built this tool

Every developer hits this daily: an API response pasted from a terminal, a config file from a container, a log line with an embedded payload — all technically readable, none of it actually readable.

The awkward part is that those payloads regularly contain access tokens, customer records, internal endpoints, and API keys. Pasting them into a random online formatter means pasting production secrets into someone else's server logs. We built ours to run entirely in your browser: the parsing and re-serialising happen in JavaScript on your machine, in your tab. Nothing is sent anywhere, so there is no upload to audit and no retention policy to trust. It also works offline once the page has loaded, which is handy when you are debugging on a locked-down network.

Tips and common mistakes

  • If formatting fails, the error position is almost always a trailing comma, a single quote where a double quote belongs, or an unescaped quote inside a string.
  • Two-space indentation is the convention in most JavaScript and web projects; four is common in Python-adjacent codebases.
  • Very large payloads are easier to read collapsed — expand only the branch you are investigating.
  • Strip credentials out of a payload before pasting it into a bug report, even though nothing left your browser here.

Open JSON Formatter with a link

Assistants and scripts can open JSON Formatter with its input already in the link, after the #, which never leaves your device:

  • #json= — the JSON document

Example: https://mygadgets.ink/tools/json-formatter/#json=... · also compressed gz fields and ?url=. How tool links work

Quick start: using JSON Formatter

  1. Paste your JSON into the input area above, or load it from a file.
  2. Choose your indentation — two spaces is the common default, four if your team prefers it.
  3. Format the document; if it is invalid, the error will point you at the offending position.
  4. Read or collapse the tree to find the part you care about.
  5. Copy the formatted output or download it as a .json file.

Related: JSON Validator for strict checking, JSON Diff to compare two payloads, and JSON to YAML to convert for config files.

What formatting does

A JSON formatter takes valid JSON and re-prints it with consistent indentation — usually two or four spaces per level — and one element per line. The data is identical; only the whitespace changes. Suddenly the nesting is obvious: objects, arrays, and their relationships line up visually so you can actually read the thing.

Formatting as a debugging tool

Beautifying often solves the problem before you even read the data. When JSON will not parse, the formatter stops at the exact point the structure breaks — a missing comma, an unclosed bracket, a trailing comma that most parsers reject. Seeing the indented structure makes mismatched braces and misplaced values jump out in a way the raw string never will.

Format vs. validate vs. minify

These three often get bundled together but do different jobs:

  • Format — makes valid JSON readable with indentation.
  • Validate — checks whether the JSON is even legal and reports errors. Use JSON Validator when you need to confirm correctness.
  • Minify — the opposite of formatting, stripping all whitespace to shrink the payload for transmission.

A common workflow: paste an API response, format to read it, validate if it looks broken, then minify the final version for production.

Common uses

  • Read an API response that came back minified.
  • Debug a config file by seeing its structure clearly.
  • Spot a syntax error the parser is complaining about.
  • Clean up hand-edited JSON before committing it.

Related Developer Tools

Browse all Developer Tools →