FileTools

JSON Formatter & Validator

Beautify, validate and minify JSON — your data never leaves your browser.

How to format JSON

  1. Paste your JSON into the input box. It’s validated instantly.
  2. Choose indentation — 2 spaces, 4 spaces or tabs — and whether to sort keys alphabetically.
  3. Click Format / Beautify for readable output, or Minify for the most compact version.
  4. Copy the result or download it as a .json file.

Validate JSON instantly

As soon as you paste, the tool tells you whether the input is valid JSON. If not, it shows the error message, the line and column of the problem, and the offending line with a ^ marker under the exact character. The most common errors are:

Error Example Fix
Trailing comma [1, 2, 3,] Remove the last comma
Single quotes {'name': 'Ada'} Use double quotes: "name"
Unquoted keys {name: "Ada"} Quote every key
Comments // note Remove comments
Missing comma {"a": 1 "b": 2} Add a comma between items
Special values NaN, undefined Use null or a number

Note that the reported position is where the parser noticed a problem — the actual mistake is often just before it, such as a missing comma on the previous line.

Beautify vs minify

Beautified JSON has line breaks and indentation, making nested structures easy to read and review. It’s ideal for debugging API responses, reading configuration files and writing documentation.

Minified JSON removes all unnecessary whitespace. It’s the smallest possible representation of the same data, which is useful for sending over a network, embedding in code or storing in a database. The output panel shows the size in bytes so you can compare.

Sorting keys

With Sort keys A–Z enabled, every object’s keys are ordered alphabetically, at every level of nesting. That makes it much easier to:

Arrays keep their original order, because in arrays the order is part of the data.

Why a local formatter matters

JSON often contains sensitive information: API keys, access tokens, customer records, internal configuration. Many online formatters send what you paste to their servers. This one parses and formats everything inside your browser — nothing is transmitted or logged, and it keeps working without a connection once the page is loaded.

JSON basics

JSON (JavaScript Object Notation) is the most common format for exchanging data between web services. It has only a few building blocks:

Type Example
Object {"name": "Ada", "age": 36}
Array ["red", "green", "blue"]
String "hello" (always double quotes)
Number 42, 3.14, -1e6
Boolean true, false
Null null

Objects and arrays can be nested inside each other to any depth. Anything outside these rules — comments, trailing commas, single quotes, undefined — makes the document invalid JSON, even if JavaScript itself would accept it.

Reading API responses

When debugging an API, copy the response body from your browser’s developer tools (Network tab → Response) or from a terminal, paste it here and click Format. Nested data becomes readable at a glance, and Sort keys makes it easy to compare two responses side by side. Because the formatter runs locally, you can safely paste responses that include session tokens or personal data, which you shouldn’t share with an online service that stores input. Clear the box when you’re done if you’re on a shared computer.

Tips

Frequently asked questions

Is my JSON sent to a server?

No. Parsing, formatting and validation all happen in your browser, so it's safe to use with API responses, configuration files and tokens.

How do I find a JSON syntax error?

Paste the JSON and look below the input. If it's invalid, you'll see the error with the line and column where it fails, plus that line with the exact character marked.

Can it format JSON with comments?

No. Standard JSON doesn't allow comments or trailing commas. Remove them first, or use a JSON5 or JSONC tool for those formats.

Does sorting keys change my data?

No. Sorting only changes the order of keys inside objects, which has no meaning in JSON. Array order is never changed.

Are very large numbers preserved?

Integers larger than 9,007,199,254,740,991 can lose precision when parsed in JavaScript. If your data contains very large IDs, keep them as strings.

Related tools