JSON Formatter

Paste JSON to pretty-print it instantly with the indentation you prefer, or minify it to a single line. Syntax errors are reported with the exact line and column and a caret under the problem, and a collapsible tree view makes large API responses easy to explore. Large numbers are kept exactly as written instead of being rounded.

How to use the JSON Formatter

  1. Paste or type JSON into the input box, or press Load example.
  2. Choose 2 spaces, 4 spaces, Tab or Minify.
  3. Tick Sort keys A–Z if you want keys in alphabetical order.
  4. Switch to Tree view to expand and collapse nested objects.
  5. Copy the result or download it as a .json file.

Features

Benefits

Frequently asked questions

Why does my JSON fail with "Trailing comma is not allowed"?

Standard JSON (RFC 8259) does not allow a comma after the last item in an object or array. Remove that comma and the document will parse.

Will formatting change my numbers?

No. Numbers are copied exactly as written, so values such as 12345678901234567890 or 1.50 are not rounded or reformatted as they would be with JSON.parse.

Does it accept comments or single quotes?

No. Comments, single-quoted strings and unquoted keys are JavaScript features, not JSON. The formatter points to them so you can fix the document.

What does Sort keys do to arrays?

Only object keys are sorted, at every nesting level. The order of array items is never changed because it is meaningful.

Related tools