Design, Developer and Productivity

JSON Formatter and Validator

Format, beautify, validate and minify JSON in your browser. See errors with their position. Free, and your data is not uploaded.

Free to use. Runs in your browser: your files and text are not uploaded.

Paste JSON to check that it is valid and to lay it out neatly. You can also squeeze it onto one line.

How to use it

  1. Paste your JSON into the box.
  2. Choose the format: 2 spaces, 4 spaces, tabs, or minified.
  3. Read the result. If the JSON is not valid, an error message says what went wrong and where.
  4. Press Copy.

The rules of JSON

JSON (JavaScript Object Notation) is defined by the standards ECMA-404 and RFC 8259. The rules are strict:

  • Strings and property names use double quotes: "name", not 'name' or name.
  • No trailing commas: [1, 2, 3,] is invalid.
  • No comments.
  • The only values are strings, numbers, true, false, null, objects {} and arrays [].
  • Numbers cannot have leading zeros or be written as NaN or Infinity.

Example

Input:

{"name":"Asha","skills":["SQL","Python"],"active":true}

Formatted with 2 spaces:

{
  "name": "Asha",
  "skills": [
    "SQL",
    "Python"
  ],
  "active": true
}

Formatting and minifying

Both versions hold exactly the same data. Formatting adds line breaks and indentation so people can read it. Minifying removes all optional spaces so the file is smaller to store and send. Programs read either one equally well.

Limits

  • Numbers larger than about 9 quadrillion (2⁵³), or with more than about 17 significant digits, lose precision when formatted, because browsers store numbers in 64-bit floating point. Large ID numbers should be sent as strings.
  • If a property name appears twice in one object, only the last value is kept.
  • Error messages come from your browser, so their wording differs between Chrome, Firefox and Safari.
  • Formats that extend JSON, such as JSON5 and JSON with comments, are reported as invalid.
  • Very large files, of tens of megabytes, may be slow.

Frequently asked questions

How do I format JSON?

Paste it into the box. If it is valid, the formatted version appears underneath with the indentation you choose. Press Copy to copy it.

Why is my JSON invalid?

The most common causes are a trailing comma after the last item, single quotes where double quotes are required, property names without quotes, and comments. JSON allows none of these.

Is it safe to paste private data here?

The JSON is processed by your own browser and is not sent to any server. As with any website, avoid pasting passwords or secret keys on a shared or untrusted computer.