SmartCalcy.Quick answers for everyday sums
/
Text & word tools

JSON formatter & validator

Paste JSON to format it with 2 or 4 spaces or tabs, minify it, or sort its keys. Invalid JSON is pinpointed by line and column with a plain-English hint, such as a trailing comma or single quotes. Nothing is sent to a server.

Your JSON

Valid JSON
147 bytes
6 keys · 1 arrays · nested 2 deep

Formatted

{
  "name": "SmartCalcy",
  "tools": 245,
  "free": true,
  "languages": [
    "en",
    "es",
    "fr"
  ],
  "owner": {
    "country": "GB"
  }
}

About the json formatter & validator

Paste JSON to format it with 2 or 4 spaces or tabs, minify it, or sort its keys. Invalid JSON is pinpointed by line and column with a plain-English hint, such as a trailing comma or single quotes. Nothing is sent to a server.

Part of SmartCalcy’s text & word tools tools. It runs in your browser with no account, uses your own currency and units (change them at the top of the page), and gives estimates for information only, so check official guidance before you rely on a result.

How to use the json formatter & validator

What it calculates and when to use it

Formats, minifies, sorts and validates JSON. Invalid JSON is located by line and column, with a plain-English hint for the most common mistakes.

How to use it, step by step

  1. Paste JSON into the box.
  2. Choose 2 spaces, 4 spaces, tabs or minify.
  3. Optionally sort keys alphabetically.
  4. Copy or download the result.

What each input means

  • Your JSON – Any JSON text.
  • Format – 2 spaces, 4 spaces, tabs or minified.
  • Sort keys – Orders object keys A–Z at every level.

How to read the results

  • Valid JSON – Size of the formatted output, with the number of keys, arrays and nesting depth.
  • Error – For invalid JSON: line, column, the lines around it and a hint.

The formula

The input is parsed with the browser’s standard JSON parser, then written back out with the chosen indentation. Keys are sorted recursively when that option is on.

A worked example

The starting example is valid and formats to 147 bytes with 2-space indentation: 6 keys, 1 array, nested 2 levels deep.

Assumptions and limits

  • Strict JSON only: comments, single quotes and trailing commas are errors.
  • Numbers keep JavaScript precision; very large integers may lose digits.

Common mistakes

  • Trailing commas after the last item.
  • Single quotes instead of double quotes.
  • Unquoted keys copied from JavaScript.

Frequently asked questions

Is my JSON sent anywhere?

No. It is processed in your browser.

Why is my JSON invalid?

The hint names the most likely cause, such as a trailing comma or single quotes.

Can it minify JSON?

Yes. Choose Minify to remove all whitespace.

Related tools