Skip to main content

JSON Formatter

Turn minified JSON into something you can read.

Paste a single-line API response and get properly indented, readable JSON back. Jsonviewpro validates the input first, so if something is wrong you get the line, the column and a plain-English explanation instead of a cryptic parser message.

Array order is always preserved — only whitespace, and optionally key order, change.

Input JSON

Size: 0 BLines: 0

Formatted JSON

Paste valid JSON to see the output.
Size: 0 BLines: 0

What does formatting JSON do?

Formatting — also called pretty-printing or beautifying — adds line breaks and indentation so the structure of a document becomes visible. It does not change the data: the same keys, values, order and types come out the other side.

Because whitespace between tokens is insignificant in JSON, formatted and minified documents are interchangeable for any parser. The difference is purely for humans.

How to format JSON

  • Paste your JSON, drop a file on the editor, or press Upload.
  • Choose an indentation style: 2 spaces, 4 spaces, 8 spaces or tabs.
  • Press Format JSON, or use the keyboard shortcut Cmd/Ctrl + Enter.
  • Copy the result, or download it as a .json file.

Which indentation should I use?

Two spaces is the most common convention for JSON and is what most linters and editors default to. Four spaces reads well for shallow configuration files. Tabs are worth choosing when the file will be edited by people with different accessibility needs, since tab width is a reader preference.

If you are committing the file to a repository, match whatever your project already uses — a formatter change that rewrites every line makes diffs unreadable.

Sorting keys

Optionally sort object keys alphabetically while formatting. This makes two versions of the same document far easier to compare by eye, and produces a canonical form for checksums. Array order is always preserved, because reordering array items would change the meaning of the document.

Why is my JSON invalid?

The most common causes are a trailing comma before a closing bracket, single quotes instead of double quotes, unquoted property names, comments (JSON has none), and JavaScript or Python literals such as undefined, NaN, True or None.

Jsonviewpro names the specific problem, points at the line and column, and — where the fix is unambiguous — offers a one-click repair that shows you exactly what it changed.

Frequently asked questions

Does formatting change my data?
No. Only insignificant whitespace changes. Keys, values, types and array order are identical before and after.
Can I format invalid JSON?
Not directly — a document has to parse before it can be re-serialized. Jsonviewpro explains what is wrong and can suggest a deterministic repair, which you review and apply yourself.
Is there a keyboard shortcut?
Yes: Cmd/Ctrl + Enter, or Cmd/Ctrl + Shift + F.
Does the formatter preserve key order?
Yes, unless you explicitly turn on Sort keys. JSON objects have no defined ordering, but preserving the input order keeps diffs small.