JSON formatter and validator

Paste JSON to pretty-print it, minify it, or find out exactly why it won't parse.

Valid · 7 keys · depth 2
{
  "name": "RegexKit",
  "tools": [
    "tester",
    "builder",
    "diff"
  ],
  "private": true,
  "version": 2,
  "meta": {
    "runsIn": "browser",
    "uploads": null
  }
}

JSON rules in one minute

  • Strings and keys use double quotes. Escape " and \ inside them with a backslash.
  • Values are strings, numbers, true, false, null, objects or arrays. No undefined, NaN, dates or functions.
  • No trailing commas and no comments (that's JSON5 or JSONC, which VS Code settings use).
  • Numbers have no leading zeros or + sign; very large integers lose precision in JavaScript beyond 253.

The format is defined by RFC 8259 and ECMA-404. On the command line, jq . file.json pretty-prints and python -m json.tool file.json validates. Need a value out of a JSON string with a pattern? Try it in the regex tester — though for anything nested, parse it instead.

Questions

Is my JSON sent to a server?

No. It is parsed with your browser's built-in JSON.parse and formatted on the page — safe for API responses containing tokens or personal data.

Why is my JSON invalid?

The usual suspects: single quotes instead of double, unquoted keys, a trailing comma after the last item, comments, or JavaScript values like undefined. The error message shows the line and column, and a hint names the most likely cause.

What does "Sort keys" do?

It orders object keys alphabetically at every level. That makes two JSON documents with the same data but different key order identical — useful before comparing them in the diff checker.

How large a file can it handle?

Several megabytes is fine on a laptop. Very large files (100 MB+) are better handled with a command-line tool such as jq.