JSON Formatter & Validator
Make messy JSON readable and find errors by line and column.
How to use the JSON Formatter & Validator
- Paste your JSON into the left panel, open a .json file, or drop one onto it.
- The formatted result appears on the right instantly. If there is a mistake, you will see the line and column.
- Pick 2 spaces, 4 spaces or tabs, and optionally sort keys alphabetically.
- Copy the result or save it as a .json file.
Examples
About this tool
JSON (JavaScript Object Notation) is the most common format for APIs, configuration files and data exchange. Machines are happy with it squeezed onto one line, but people are not. This formatter re-indents JSON so every object and array sits on its own level, which makes it far easier to read, review and debug.
It also acts as a validator. If the JSON is invalid, you get a plain-English message with the line and column of the problem, plus the surrounding text, so you can fix a missing comma or quote in seconds. The forgiving mode quietly repairs the two most common copy-paste problems: trailing commas and // comments.
Sorting keys alphabetically is handy when comparing two JSON documents or keeping configuration files tidy in version control.
Frequently asked questions
Is my JSON sent to a server?
No. Formatting and validation happen entirely in your browser. Your data never leaves your device, which makes the tool safe for API keys, tokens and private records.
How large a JSON file can I format?
Files of several megabytes format comfortably. Very large files (50 MB+) depend on your device memory, since everything runs locally.
What does "forgive trailing commas & comments" do?
Strict JSON does not allow a comma after the last item or // and /* */ comments. With this option on, the tool removes them before parsing so you still get valid, standard JSON out.
Why does it say my JSON is invalid?
Common causes are single quotes instead of double quotes, unquoted keys, a missing comma between items, or a stray character. The error message shows exactly where parsing stopped.