Skip to content

JSON Formatter & Validator

Paste JSON to pretty-print it, validate it and find the error line

Loading the tool…

Paste JSON to check that it is valid and to format it with clean indentation; errors are shown with their line, column and a likely cause. Use it to read or fix an API response or a configuration file.

How to use

  1. Paste into "JSON input" or press "Open file". You can also drop a file on the box.
  2. Under "Indentation", choose "2 spaces", "4 spaces" or "Tab", or choose "Minify" for a single line. Turn on "Sort keys" to put the keys in order.
  3. If it says "Invalid JSON", use "Go to the error". If comments or trailing commas are the cause, press "Try loose repair".
  4. On the "Tree" tab, expand and collapse the structure, search it, or use "Copy path" to copy a path such as $.a.b[0]. Copy the result or press "Save as .json".

How it works

Questions and answers

How do I find the error in my JSON?
Paste it: "Invalid JSON" appears with the line, column and the problem. A comma after the last item, single quotes and comments are the usual causes.
Can JSON contain comments?
No. The JSON standard has no // or /* */ comments, so remove them or press "Try loose repair".
What does minify JSON mean?
It removes all spaces and line breaks that are not inside strings, leaving one line. The data stays the same; only the size shrinks.
Why do large number IDs change?
JavaScript numbers cannot hold integers above 9,007,199,254,740,991 exactly, so they are rounded. Sending such IDs as strings avoids this.