Developer Tools

JSON Formatter & Validator

Check JSON, see the exact line and column of any error, and format or minify it, all inside your browser.

By Nitin Raturi · Last reviewed

Input

How to use the JSON Formatter & Validator

Check that JSON is valid and turn it into readable or compact text.

  1. Paste your JSON into the box.
  2. If it is invalid, read the message: it gives the line and column of the first problem.
  3. Choose Format or Minify, and the indentation.
  4. Copy the result, or explore it in the tree view.

Good to know

  • Tap the ⓘ next to any field for a short guide to it.
  • Nothing you paste is uploaded or saved in the link.

Validates strict JSON (RFC 8259) and reports the line and column of the first problem.

Runs in your browser. Nothing you type is uploaded or saved in the link.

JSON text

The JSON you want to check, format or minify. It stays in your browser.

How to fill it in

  • Paste the text, or type it. Large files work; the check runs as you type.
  • Keys and strings need double quotes. Trailing commas and comments are not allowed in JSON.

Example

A trailing comma after the last array item is reported at line 3, column 29.

Keep in mind: Avoid pasting real passwords, tokens or personal data into any online tool, even one that runs locally.

Output style

Format adds line breaks and indentation for reading. Minify removes all spare spaces for sending.

How to fill it in

  • Choose Format to read or review. Choose Minify to make the smallest text.

Indentation

How far each nested level is pushed in when formatting.

How to fill it in

  • Choose 2 spaces, 4 spaces or a tab. Match your project’s style.

Sort keys A to Z

Orders the keys of every object alphabetically, at every level.

How to fill it in

  • Turn it on to compare two documents, or to make keys easy to scan.
  • Array order is never changed.

Result

Valid JSON

Size
70 bytes
Output size
100 bytes
Keys
4
Depth
3

Formatted JSON

{
  "name": "WebTools",
  "tools": [
    "JSON",
    "Base64"
  ],
  "local": true,
  "version": 1
}

Tree view
  • root object, 4 keys
    • name: "WebTools"
    • tools array, 2 items
      • 0: "JSON"
      • 1: "Base64"
    • local: true
    • version: 1

How this calculator works

  1. Step 1Read every characterRFC 8259A strict parser follows the JSON grammar, one character at a time.
  2. Step 2Stop at the first problemLine and columnIt reports exactly where the text stops being valid JSON.
  3. Step 3Rewrite the valueFormat or minifyValid JSON is printed again with your chosen spacing.

JSON is a text format for data: objects in braces, arrays in brackets, strings in double quotes, numbers, true, false and null. The check runs in your browser, so nothing is uploaded.

Worked example: finding a trailing comma

A comma after the last item is a common mistake. Here it is found at line 3, column 29.

Checking a document with one mistake
Text checked
{ "name": "WebTools", "tools": ["JSON", "Base64",] }
  1. Line 1: an object opens{
  2. Line 2: key "name" and a string valuevalid
  3. Line 3: key "tools" and an arraytwo strings
  4. Next character after the last comma]
  5. ResultLine 3, column 29: trailing comma

Remove that comma and the document is valid. Many editors and JavaScript allow trailing commas, but JSON does not.

Reading the result

  • FormatReadableOne value per line with indentation, for reviewing and debugging.
  • MinifyCompactNo spare spaces or line breaks, for sending or storing.

The summary counts keys and nesting depth. The sample on first load has 4 keys and a depth of 3. Duplicate keys are flagged, because most parsers silently keep only the last one.

  • GrammarBrackets, commas, colons and quotes in the right places.
  • StringsDouble quotes, valid escapes and no raw tabs or line breaks.
  • NumbersNo leading zeros, no trailing dots, no NaN or Infinity.
  • Duplicate keysFlagged as a warning, since the JSON standard advises unique names.

JSON is often the end of a data pipeline. Other tools convert, compare and decode it.

To turn a spreadsheet export into JSON, use the CSV to JSON converter. The diff checker compares two versions, and the JWT decoder reads the JSON inside a token.

Common mistakes

  • Mistake: Using single quotes around keys or strings.

    Instead: JSON needs double quotes everywhere.

  • Mistake: Leaving a comma after the last item.

    Instead: Remove it; JSON does not allow trailing commas.

  • Mistake: Adding comments to explain a value.

    Instead: JSON has no comments; put notes in a separate field or file.

  • Mistake: Pasting live API keys or passwords into online tools.

    Instead: Replace secrets with placeholders before you paste.

Read how we test our calculators, or browse more developer tools.

Frequently asked questions

Is my JSON uploaded anywhere?

No. The check and the formatting run in your browser. The text is not sent to a server and is not saved in the page link; only your display settings are.

Why does it say my JSON is invalid when JavaScript accepts it?

JavaScript object syntax allows single quotes, trailing commas, comments and unquoted keys. Strict JSON (RFC 8259) allows none of them.

How is the error position counted?

Lines and columns start at 1. The column is the position of the first character that cannot continue a valid document, counted the way most code editors count.

Are duplicate keys an error?

The grammar allows them, but the JSON standard says names should be unique, and most parsers keep only the last value. The tool warns you and names them.

Does sorting keys change my data?

It changes only the order of keys inside objects. Values and the order of array items stay the same.

Sources and methodology

The formulas are standard time-value-of-money results. We check every figure against golden values worked out independently, by closed form and by month-by-month simulation; see the methodology.

Written and maintained by Nitin Raturi, a software engineer (about the author). Last reviewed 27 Oct 2026; next review due by . Found an error? Tell us.

Changelog

  • : Initial release. Demand metrics remain unverified.