Free tool · No signup · Private

JSON Formatter and Validator

Paste JSON to pretty-print it, minify it, or find out exactly why it's invalid. Errors point to the line and column with a plain-English fix, and nothing you paste leaves your browser.

By Suman Sharma · Updated

JSON formatter · validatorLocal

How to use this tool

  1. Paste your JSON

    Drop in a response, config file or any JSON text.

  2. Format or minify

    Choose 2 spaces, 4 spaces or tabs, optionally sort keys, then tap Format & validate or Minify.

  3. Fix errors or copy the result

    If it's invalid, the error shows the line, column and what to change. If it's valid, copy or download the result.

Example

A config pasted with trailing commas, then fixed and formatted with sorted keys.

Input

{
  "name": "Suman",
  "tools": ["json", "qr",],
}

Result

Line 3, column 26:
Trailing comma before ]. Remove the last comma.

After removing both trailing commas, with
2 spaces and "Sort keys" on:

{
  "name": "Suman",
  "tools": [
    "json",
    "qr"
  ]
}

2 keys · 2 levels deep · 60 bytes

Errors you can actually act on

Browsers report JSON errors in different ways, and recent versions of Chrome don't even say where the problem is. This tool reads your JSON itself to find the first spot where it breaks, then shows the line, the column and a caret under the character.

It recognises the mistakes people make most often and tells you how to fix them:

  • Trailing commas: [1, 2,] or {"a": 1,} aren't allowed in JSON.
  • Single quotes: JSON strings and keys need double quotes.
  • Unquoted keys: {name: 1} must be {"name": 1}.
  • Missing colons or commas between items.
  • Unclosed strings and line breaks inside strings (use \n).
  • Invalid escapes and extra text after the end of the JSON.

Format, minify or sort

After formatting you also see how many keys the data has, how deeply it's nested and its size in bytes.

  • Format (beautify): adds indentation and line breaks so nested data is easy to read.
  • Minify: removes all whitespace for the smallest payload, handy for API requests and config.
  • Sort keys: orders object keys A–Z at every level, which makes two JSON files much easier to diff.

Safe for real data

Plenty of online formatters send your JSON to a server. This one doesn't. Parsing and formatting happen in your browser, so API keys, tokens and customer data in your payload stay on your machine.

JSON syntax rules in one place

  • Strings: always double quotes, and special characters escaped (\", \\, \n, \t).
  • Keys: always strings in double quotes.
  • Values: string, number, true, false, null, object or array. No undefined, NaN or functions.
  • Numbers: no leading zeros (07), no trailing dot (1.), no hex (0x1F).
  • No comments and no trailing commas.
  • The top level can be any value, though most APIs send an object or array.

JSON vs JavaScript objects

JSON looks like a JavaScript object, but it's a stricter text format. JavaScript lets you skip quotes on keys, use single quotes, leave trailing commas and write comments; JSON allows none of these. That's why a config copied from a JS file often fails to parse.

If you need comments in config files, formats like JSONC (used by VS Code and tsconfig.json), JSON5 or YAML allow them, but a standard JSON parser will still reject them.

Common errors

  • Comments in config files

    tsconfig.json and VS Code settings accept // comments, but that's JSONC, not JSON. Remove the comments before validating, or expect an error at the first slash.

  • Curly quotes from Word, Slack or Notes

    “Smart” quotes aren't valid JSON quotes. Copy from a plain-text source, or replace them with straight double quotes.

  • Extra text around the JSON

    Log lines often have a timestamp or label before the object. Paste only the part from the first { or [ to its closing bracket.

  • Big IDs change after formatting

    Numbers above 9,007,199,254,740,991 lose precision in JavaScript, so a 19-digit ID can come back with different last digits. APIs should send IDs that large as strings.

Frequently asked questions

How do I format JSON?

Paste it into the box and tap Format & validate. Pick 2 spaces, 4 spaces or tabs for the indentation.

How do I find the error in my JSON?

Tap Format & validate. If the JSON is invalid, you'll see the exact line and column, the broken line with a marker under the problem, and a short explanation such as 'Trailing comma before }'.

Why is my JSON invalid?

The most common causes are trailing commas, single quotes instead of double quotes, keys without quotes, and comments. Standard JSON doesn't allow any of these.

Is it safe to paste sensitive JSON here?

Yes. Nothing is uploaded. All parsing and formatting runs locally in your browser.

What's the difference between formatting and minifying?

Formatting adds indentation and line breaks to make JSON readable. Minifying strips every unnecessary space to make it as small as possible. The data itself is identical.

Can JSON have comments?

No. Standard JSON doesn't allow comments. Some tools accept JSONC or JSON5, which do, but APIs and JSON.parse expect plain JSON. Remove the comments or move them into a field like "_comment".

How do I validate JSON?

Paste it and tap Format & validate. Valid JSON is formatted straight away; invalid JSON shows the line and column of the first error with a short explanation.

Contact

Get in Touch

Want to call me? book a call and I'll respond in the available time slot. I will ignore all soliciting.