JSON Formatter and Validator

Validate your JSON, pretty print it, sort its keys or minify it. Syntax errors are pinpointed to the exact line and column.

Your JSONCtrl + Enter
Result

Pretty print JSON in one click

JSON (JavaScript Object Notation) is the most widely used data format for web APIs, and responses almost always arrive minified on a single line. This JSON beautifier adds line breaks and indentation to reveal the structure of objects and arrays.

The most common JSON errors

  • Trailing comma after the last item: [1, 2, 3,] is not allowed in JSON.
  • Single quotes instead of double quotes: {'name': 'Paul'} is not valid JSON.
  • Unquoted keys: {name: "Paul"} is JavaScript, not JSON.
  • Comments: standard JSON does not support them.
  • Unsupported values: undefined, NaN and Infinity are not allowed.

When the JSON is invalid, the validator shows the line and column of the problem so you can fix it quickly.

Sort keys and minify

Sort keys orders the properties of every object alphabetically, at every level. It is very useful for comparing two API responses or keeping a versioned config file stable. Minify removes all unnecessary whitespace to shrink the payload.

100% client-side

Your JSON is parsed in your browser with the native JavaScript parser. Nothing is sent over the network, so you can safely paste tokens, customer data or configuration files.

FAQ

What is the difference between JSON and a JavaScript object?

JSON is a stricter text format: keys and strings must use double quotes, and trailing commas, comments and functions are not allowed.

Does the tool change my values?

No, with one exception: very large integers (above 253) may lose precision, as in any JavaScript program.

How many spaces should I use to indent JSON?

There is no official rule. Two spaces is the most common convention, especially in the JavaScript world; four spaces is common in Python and Java.

More free tools