JSON formatter and validator

JSON (JavaScript Object Notation) is a text format for structured data made of objects, arrays, strings, numbers, booleans, and null.

Format, validate, minify and sort JSON online, with the exact parser error when it is invalid. Free, and your JSON never leaves your browser.

Browser-sideNo accountCopy, download, or print

Last reviewed

Your inputs are saved as a draft in this browser only. Nothing is uploaded.

Jump to result
Interactive workspace

Inputs

Result

More export options

Characters75
Lines1
Total keys7
Depth3

Top-level keys

KeyType
statusstring
dataarray (1)
metaobject
{
  "status": "ok",
  "data": [
    {
      "id": 1,
      "name": "Acme"
    }
  ],
  "meta": {
    "page": 1,
    "count": 1
  }
}

Examples

Pretty-print minified JSON

{"id":1,"tags":["a","b"]} formatted with a 2-space indent puts "id" and "tags" on their own lines and each array item on its own line inside the brackets.

Minify for a request body

Choose Minify to remove every space and line break outside strings, so a formatted payload becomes a single line such as {"id":1,"tags":["a","b"]}.

Sort keys for a clean diff

{"b":2,"a":{"d":4,"c":3}} sorted recursively becomes {"a":{"c":3,"d":4},"b":2}. Array items keep their order; only object keys are sorted.

Trailing comma

{"a":1,} is invalid JSON. Remove the comma after the last property or array item.

Single quotes and unquoted keys

{'a':1} and {a:1} are valid JavaScript but not JSON. Keys and strings must use double quotes: {"a":1}.

Comments

JSON has no comments, so // and /* */ lines make the input invalid. Remove them, or keep them only in formats that allow them, such as JSONC or JSON5.

Very large integers

{"id":12345678901234567890} comes back as 12345678901234567000, because JavaScript numbers lose precision above 9007199254740991. Send large IDs as strings to keep them exact.

How to use it

  1. Paste your JSON into the input field.
  2. Choose an operation: format and inspect, minify, or analyze structure only.
  3. Set the indent size and choose whether to sort keys recursively.
  4. Copy the formatted output, or fix the reported parse error and rerun.

Questions

Does it tell me why my JSON is invalid?
Yes. Invalid input returns the browser parser's error message, which usually names the unexpected character and its position, so you can find and fix the problem before formatting.
Can it sort object keys alphabetically?
Yes. Set sort keys to sort recursively and keys are ordered alphabetically at every nesting level, which makes diffs and comparisons easier. Arrays keep their original order.
Does formatting change my data?
Formatting and minifying only change whitespace. Two things can change values: if an object repeats a key, only the last value is kept, and integers above 9007199254740991 lose precision because JavaScript stores numbers as 64-bit floats.
What is the difference between JSON and a JavaScript object?
JSON is a stricter text format. It requires double-quoted keys and strings, and it does not allow trailing commas, comments, single quotes, undefined, NaN, or functions.
Which indent size should I use?
Two spaces is the most common choice for JSON in APIs and configuration files; four spaces is common in some codebases. The indent only affects readability, not the data.
Can I format XML here?
Use the API response formatter for XML. This tool is for JSON.
Is my JSON uploaded to a server?
No. Formatting and validation run entirely in your browser and nothing is uploaded.