Tooldit
BlogAboutContact
Browse Tools
HomeAll ToolsDeveloper ToolsJSON Formatter

JSON Formatter

Format, validate and minify JSON with live syntax checking.

Indent

How to use

  1. 1Paste your JSON into the input box.
  2. 2Choose Pretty to format with indentation, or Minify to compress it.
  3. 3Copy the formatted output, or switch the indent to 2 spaces, 4 spaces, or tabs.

What Is a JSON Formatter?

A JSON formatter is a tool that takes JavaScript Object Notation text — whether single-line, minified, escape-heavy, or copy-pasted from a log file — and re-renders it with consistent indentation, line breaks, and key alignment so a human can actually read the structure. It usually doubles as a validator, reporting where the JSON is malformed (missing comma, unmatched brace, trailing comma) with the line and column number. JSON is the universal data format for REST APIs, config files, log records, NoSQL documents, and most cross-language data exchange, so this is one of the most used tools in a developer's toolbox.

The people who use one regularly include backend engineers debugging API responses, frontend developers inspecting fetch payloads, QA testers comparing expected vs actual data, DevOps engineers fixing CI config, data analysts reading export files, and writers verifying localization JSON. The Tooldit JSON formatter runs the parse and re-stringify entirely in your browser, so even JSON containing API keys, tokens, or PII never leaves your device.

A fast, private JSON formatter and validator

This free online json formatter cleans up messy, single-line, or copy-pasted JSON into readable, correctly indented output — and tells you instantly when something is wrong. Paste an API response, a config file, or a chunk of data you pulled from a log, and the tool re-indents it on the fly. If the JSON is invalid, you get the exact parser error instead of a silent failure, so you can find the missing brace or stray comma without guessing. Everything runs in your browser as you type, with no build step and no waiting on a server.

How the controls work

The tool gives you a small set of focused options rather than a cluttered toolbar. Here is what each one does:

  • Pretty — re-indents your JSON with line breaks and nesting so it is easy to read and scan. This is the default mode.
  • Minify — collapses the whole document to a single line, removing every optional space and newline to produce the smallest valid output.
  • Indent— while in Pretty mode you can switch between 2 spaces, 4 spaces, or tabs, so the result matches your project's style.
  • Live validation — as you type or paste, the input is parsed immediately. Valid JSON appears formatted in the output box; invalid JSON shows the parser's error message instead.
  • Byte counter — the size of your input and output is shown side by side, so you can see exactly how much minifying saves.
  • Copy — one click copies the formatted or minified result to your clipboard, ready to paste into your editor or request body.

Why use this formatter

  • Runs in your browser — your JSON is parsed locally and never leaves the tab, so pasting a private API response or a secret-laden config is safe.
  • Genuinely free — no metered usage, no "pro" tier hiding the minify button behind a paywall.
  • No signup — there is no account, no email gate, and nothing to install. Open the page and start pasting.
  • No watermark or junk — the output is your exact data, formatted; nothing is injected into it.
  • Instant feedback — validation happens the moment you stop typing, not after a submit button.

Everyday uses

  • Debugging an API — paste a raw response that came back as one long line and instantly read its structure to confirm a field is present or correctly nested.
  • Fixing a broken config — drop in a package.json, tsconfig, or settings file that won't load and let the validator pinpoint the trailing comma or missing quote.
  • Shrinking a payload — minify a large JSON body before embedding it in a script, a URL parameter, or an environment variable where every byte counts.
  • Cleaning data for a PR — re-indent a fixture or seed file to your repo's 2-space or tab convention before committing it so the diff stays clean.

JSON Formatter vs Other Tools

Versus jq (CLI) — jq is the gold standard for filtering and transforming JSON on the command line, but its query language has a learning curve. For just "prettify this", the browser formatter is one paste away.

Versus your IDE's "Format Document" — VS Code, IntelliJ, and Sublime all prettify JSON, but only files that are already saved with a .json extension. When you've copied a response from a log or a curl output, Tooldit is faster than opening a new scratch file.

Versus other online formatters — many free formatters upload your JSON to a server before formatting. For payloads with API keys, customer data, or signed tokens, that's a leak risk. Tooldit's formatter runs in your browser; no payload touches a server.

Versus the JSON.stringify hack — JSON.stringify(JSON.parse(s), null, 2) works in any browser console but only outputs to the console (not a copyable block) and breaks on malformed input with no helpful error. The formatter shows the error location.

Troubleshooting & Common Issues

  • "Unexpected token" error — usually means a trailing comma, single quotes instead of double quotes, or a missing closing bracket. Check the line number reported in the error; the issue is usually a few characters before that.
  • Comments not allowed — standard JSON doesn't support "//" or "/* */" comments. If your file is JSON-with-comments (JSONC, like tsconfig.json), remove them or run the file through a JSONC stripper first.
  • Numbers come out as strings — JavaScript's number type can't hold more than ~15 significant digits; very large IDs are often serialized as strings to preserve precision. The formatter doesn't convert — it preserves what's in the source.
  • Escaped quotes look weird in the output — JSON strings escape inner double-quotes as\". The formatter shows them as escapes (correct JSON). If you want literal quotes, decode the string first (it's probably a JSON-encoded string within JSON).
  • Very large file freezes the browser — parsing a 100 MB+ JSON file allocates a lot of memory. For huge files use jq or a streaming parser (ijson in Python, JSONStream in Node).
  • Output reorders keys — some formatters sort keys alphabetically. Tooldit preserves insertion order. If you need sorted output, run through jq -S afterward.

Frequently Asked Questions

+Why does my JSON show an error when it looks fine?

The formatter uses the browser's strict JSON.parse engine, which follows the JSON spec exactly. The most common causes are a trailing comma after the last item in an object or array, single quotes instead of double quotes around keys and string values, unquoted keys, or comments — none of which are valid JSON even though many languages accept them. The error message shown comes straight from the parser and usually points to the position of the problem.

+What is the difference between Pretty and Minify?

Pretty re-indents your JSON with line breaks so it is easy to read and review, using 2 spaces, 4 spaces, or tabs depending on the indent option you pick. Minify strips every optional space and newline to produce the smallest possible single-line output, which is what you want for API payloads, config values, or anything where size matters.

+Does the formatter change the meaning of my data?

No. It parses your input into a JavaScript value and re-serializes it, so the keys and values are identical — only the whitespace and formatting change. One thing to note is that re-serializing normalizes the output: duplicate keys collapse to the last value, and key order follows standard JSON.stringify behavior.

+Is my JSON uploaded anywhere?

No. Formatting, validation, and minifying all happen locally in your browser tab using the built-in JSON engine. Your data is never sent to a server, which makes it safe to paste API responses, config files, or other sensitive payloads.

+What do the byte counts next to the output mean?

The tool measures the size of your input and the size of the formatted or minified output in bytes and shows them side by side. It is a quick way to see how much you save by minifying, or how much indentation adds when you pretty-print.

+What's the difference between JSON and JSON5/JSONC?

Standard JSON has strict rules: double-quoted keys, no trailing commas, no comments. JSON5 and JSONC (JSON with Comments) loosen those rules for human-edited config files like tsconfig.json. The formatter expects standard JSON; strip comments and trailing commas first if your source is JSONC.

+How do I minify JSON for production?

Click the Minify button (or set indentation to 0) to strip every space, tab, and newline. The result is semantically identical but typically 20–40% smaller, which matters when transmitting over a slow network or storing many records.

+Can the formatter validate against a JSON Schema?

Not in this version — the formatter validates syntax but not against a schema. For schema validation, use Ajv (JavaScript) or jsonschema (Python). Catching syntax errors first is still the right first step.

Related developer tools

Working with code and data? Pair this with Tooldit's code minifier to shrink CSS and JavaScript, encode payloads with the Base64 encoder, or browse all developer tools. Every one of them runs entirely in your browser.

Footer

Tooldit

Free, private, browser-based PDF, image, and AI tools. No sign-up, no uploads — your files never leave your device.

info@tooldit.com
  • Private
  • Fast
  • Offline
  • Free Forever

PDF Tools

  • Merge PDF
  • Split PDF
  • Compress PDF
  • PDF to Images
  • Image to PDF

Image Tools

  • Image Editor
  • Image Cropper
  • Image Merge
  • PNG Converter
  • JPG Converter

Calculators

  • Age Calculator
  • Percentage Calculator
  • BMI Calculator
  • Tip Calculator
  • GPA Calculator

Text & Dev

  • Word Counter
  • Character Counter
  • Case Converter
  • Lorem Ipsum Generator
  • Text Diff Checker

AI & Utility

  • Background Remover
  • Object Remover
  • Internet Speed Test
  • Typing Speed Test
  • Stopwatch & Timer
  • Games

Company

  • Blog
  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 Tooldit. All tools run locally in your browser.