Skip to content
APK Peer

JSON Formatter & Validator

Free · runs in your browser · nothing uploaded

Quick answer

This JSON formatter makes messy or minified JSON readable with consistent indentation, minifies it to a single line for production, and validates it with a clear error message when something's wrong. Choose two spaces, four spaces or tabs. It runs in your browser, so API responses and config files are never uploaded.

Valid JSON79 characters

How to format JSON

  1. Paste your JSON into the Input box.
  2. Choose 2 spaces, 4 spaces, Tabs or Minify.
  3. If the JSON is valid, the formatted version appears with a "Valid JSON" note. If not, you'll see an error message.
  4. Copy the result.

Common JSON errors

ErrorInvalidValid
Trailing comma[1, 2, 3,][1, 2, 3]
Single quotes{'name': 'x'}{"name": "x"}
Unquoted key{name: "x"}{"name": "x"}
Comments{"a": 1 // note}Not allowed in JSON
Special valuesNaN, undefinedUse null instead

JSON looks like JavaScript, but it's stricter. Files that work in JavaScript code often fail as JSON for exactly these reasons. The error message points to where the parser gave up, which is usually just after the real mistake, so look at the character before the position it mentions.

Format or minify?

Formatting adds indentation and line breaks so you can read the structure, find a value quickly and compare two versions. Minifying removes all unnecessary whitespace, making the file smaller to send over a network or store in a database. Both contain exactly the same data.

Useful for

  • Reading API responses that arrive as one long line.
  • Checking configuration files for apps, servers and tools.
  • Tidying exported data before committing it to a code repository.

Private by design

JSON often contains API keys, tokens and personal data. This formatter uses your browser's built-in JSON parser, so nothing you paste is uploaded or logged. For encoded values inside JSON, the Base64 decoder and URL decoder can help.

Frequently asked questions

Why is my JSON invalid?

Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, and comments, none of which standard JSON allows. The error message points to where parsing failed, which is usually just after the real mistake.

What's the difference between formatting and minifying?

Formatting adds line breaks and indentation so people can read the structure. Minifying removes all unnecessary whitespace to make the file smaller, which is better for sending over the network or storing in code.

Is my JSON sent to a server?

No. Parsing and formatting happen in your browser using its built-in JSON engine, so API keys, tokens or personal data in your JSON never leave your device.

Last updated by the APKPeer Editorial Team. Read our privacy policy for how the site handles data.