tomai
Log in
Free · Developer Tools

JSON Formatter

Format, validate, minify and sort JSON — 100% in your browser

Input
Output

Technical details worth knowing

JSON is defined by RFC 8259, and three corners of that spec bite people in real projects:

  • Numbers are IEEE-754 double-precision floats — integers beyond 2⁵³ (e.g. 9007199254740993) silently lose precision in any JavaScript-based parser, which is why IDs from APIs often arrive as strings.
  • Duplicate keys are not forbidden by the spec; parsers commonly keep the last occurrence, and this formatter does the same.
  • Validation reports the first syntax error with its exact line and column, then stops — fix it, run again, meet the next one if there is one.

What Is a JSON Formatter?

A JSON formatter takes raw JSON text — often a single cramped line straight from an API response, a config file, or a log — and turns it into readable, indented structure. This one also validates, minifies, sorts keys, and reports size statistics. It solves the very practical problem of eyeballing unreadable JSON: when an endpoint returns dozens of nested objects on one line, finding a missing comma or a wrong value by eye is miserable. The tool is aimed at developers, DevOps engineers, QA testers, and anyone who works with APIs, configuration files, or stored data. Because everything runs inside your browser, you can paste production data without worrying about leaks.

What this tool can do

  • 🧹 Beautify with 2-space, 4-space, or Tab indentation
  • ⚡ Minify to a compact single line in one click
  • ✅ Validate syntax and pinpoint errors with exact line and column numbers
  • 🔤 Sort object keys alphabetically, recursively through every level
  • 📊 Show byte size, key count, and nesting depth
  • 💾 Copy the result or download it as a .json file

When you will use it

  • Debugging an API response before writing client code against it
  • Cleaning up a config file for readability
  • Minifying JSON to stay under an API payload size limit
  • Auditing deeply nested data structures pulled from logs

Privacy: your JSON never leaves your browser. Formatting, validation, and statistics all happen locally, so pasting sensitive configuration or production payloads is safe. The tool is free and needs no registration.

Why use this instead of an editor plugin

🧭

Format, sort, and measure

Beautify raw JSON with two-space, four-space, or tab indentation, toggle deep key sorting, and read byte count, key count, and nesting depth from the status line after every run.

🎯

Errors with exact positions

Validation reports the precise line and column of the first syntax error, so a missing comma deep inside a nested object points straight at the fix instead of ending in a generic parse failure.

📦

Minify, copy, or download

Minify collapses the same document to a single line for tight payloads, then copy it or save it as formatted.json.

Frequently asked questions

Is my JSON uploaded to a server?

No. Formatting, validation and minification run entirely in your browser with JavaScript. Your data never leaves your device, which makes this tool safe for API keys, customer data and other sensitive payloads.

How do I find syntax errors in JSON?

Click Validate (or Format). If the JSON is invalid, we show the parser message plus the exact line and column of the first error, so you can jump straight to the problem — trailing commas, single quotes and unquoted keys are the most common causes.

What does “Sort keys” do?

It recursively sorts every object’s keys alphabetically before output. Sorted JSON is easier to diff in code review and produces stable output for caching and hashing.

Why does a long ID change its last digits after formatting?

It does not change because of formatting — it changes when the text is parsed into a JavaScript number. Anything past 2⁵³ ≈ 9×10¹µ exceeds double-precision mantissa, so trailing digits get rounded. Keep such values quoted as strings in your JSON.

Related tools

Related tools