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
- Paste into "JSON input" or press "Open file". You can also drop a file on the box.
- 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.
- If it says "Invalid JSON", use "Go to the error". If comments or trailing commas are the cause, press "Try loose repair".
- 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
- "Try loose repair" removes comments and trailing commas, turns single quotes into double quotes, quotes bare keys and replaces Python's True, False and None.
- It warns about integers beyond ±9,007,199,254,740,991 and about duplicate keys. Formatting keeps every digit of large integers.
- Parsing runs in a background worker, so files of several MB do not freeze the page; files up to 100 MB can be opened. The JSON is processed only in this browser and is not saved or sent.
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.