JSON Formatter

Works fully offline Developer

Paste minified or messy JSON and get a clean, indented, human-readable version back — with syntax errors flagged as soon as they're found.

0 characters

    

Overview

JSON is the default data format for APIs, config files, and logs, but it's rarely readable in the shape it actually arrives in. Server responses are usually minified to save bandwidth, log lines squeeze a whole object onto one line, and hand-edited config files drift out of consistent indentation over time. This tool takes any of that and reformats it with consistent indentation (2 spaces, 4 spaces, or tabs), or minifies it back down to a single line, so nested objects and arrays are actually easy to scan.

Formatting and validation happen in the same step. JSON's syntax is strict — a trailing comma, an unescaped quote, or a missing bracket makes the whole document invalid — so if the input can't be parsed, the tool reports the exact line and column instead of guessing at a fix. That makes it a fast way to confirm whether a JSON blob is well-formed before you paste it into code, a config file, or another tool.

Everything runs client-side with the browser's native JSON parser. Nothing you paste is uploaded, logged, or sent to a server, which matters when the JSON you're debugging contains API keys, tokens, or other data you'd rather not put on the wire twice.

Examples & Sample Data

Minified input

Input
{"name":"Adikya","active":true}
Output
{
  "name": "Adikya",
  "active": true
}

How It Works

  1. Paste your JSON into the input box. Pasting a complete document into an empty box formats it straight away.
  2. Choose an output style: 2 spaces, 4 spaces, tabs, or minified. Tick Sort object keys to order keys alphabetically at every level.
  3. Click Format, or press Ctrl+Enter (Cmd+Enter on a Mac).
  4. If the JSON is invalid, read the line and column in the error message. The offending line is shown with a caret under the problem.
  5. Copy the result, or download it as a .json file.

Common Use Cases

Debugging an API response

Paste a minified response body from a browser network tab or a curl call to quickly see its actual structure instead of scrolling through one long line.

Cleaning up a config file

Reformat a hand-edited or auto-generated JSON config so indentation is consistent before committing it.

Validating JSON before use

Confirm a payload is syntactically valid JSON before pasting it into code, a request body, or another tool that expects strict JSON.

Reviewing log output

Expand a single-line JSON log entry into readable form to check which fields are present and what values they hold.

Tips & Best Practices

  • JSON doesn't allow trailing commas — a comma after the last item in an object or array is a common cause of "invalid JSON" errors.
  • Object keys and all string values must use double quotes, not single quotes.
  • Comments aren't part of the JSON spec, so a file with // or /* */ comments (sometimes called JSONC) will fail to parse here.
  • For very large inputs, formatting may take a moment since it runs in your browser's main thread rather than on a server.
  • If you only need to check validity and don't care about formatting, an error message alone confirms the input is invalid without needing to read the whole output.
  • Press Ctrl+Enter (Cmd+Enter on a Mac) to format without reaching for the mouse.

Frequently Asked Questions

No. Formatting happens entirely in your browser using JavaScript.

No hard limit is enforced, but very large inputs may be slow to format in the browser.

The most common causes are a trailing comma, single quotes instead of double quotes, or an unescaped quote inside a string. JSON's grammar is stricter than JavaScript's object literal syntax.

Yes. Choose Minify as the output style to strip all whitespace, or pick 2 spaces, 4 spaces, or tabs to format it.

No. This tool validates against strict JSON syntax, so comments and other JSON5 extensions will be reported as errors.

No. Numbers and strings are kept exactly as you wrote them, so an ID like 12345678901234567890 is not rounded. Many formatters silently round integers larger than 2^53 because they re-encode through JavaScript numbers.

Related Tools

Explore more high-performance utilities.