How to format JSON online
- Paste your JSON into the Input box, or click Sample to try it.
- Click Format to beautify it, or Minify to compress it to a single line.
- If there is a mistake, the error message shows the line and column and selects it in the input.
- Copy the result or download it as a
.jsonfile.
Common JSON errors and how to fix them
| Mistake | Wrong | Right |
|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] |
| Single quotes | {'city': 'Lahore'} | {"city": "Lahore"} |
| Unquoted key | {salary: 90000} | {"salary": 90000} |
| Comment | {"a": 1 // note} | {"a": 1} |
| Missing comma | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
JSON (JavaScript Object Notation) is the most common format for REST APIs, configuration files and data exchange. Readable, correctly formatted JSON makes API debugging, code reviews and technical interviews much easier.
Frequently asked questions
What does a JSON formatter do?
It adds line breaks and indentation to JSON so it is easy to read (also called beautifying or pretty-printing). It can also do the opposite and minify JSON by removing all unnecessary spaces, which makes it smaller to send over a network.
How do I find the error in my JSON?
Click Validate or Format. If the JSON is invalid, the tool shows the error message with the line and column number and highlights that position, so you can jump straight to the problem.
What are the most common JSON errors?
A trailing comma after the last item, single quotes instead of double quotes, keys without quotes, comments (JSON does not allow comments) and missing commas or brackets.
Is it safe to paste API responses or config files here?
Yes. The formatter runs entirely in your browser with JavaScript; your JSON is never sent to our server or stored. Even so, avoid pasting live passwords or secret keys into any website.
What is the difference between JSON and a JavaScript object?
JSON is a text format with strict rules: keys and strings must use double quotes, and functions, comments, undefined and trailing commas are not allowed. A JavaScript object literal is more relaxed.
More free developer tools
Looking for work? Browse the latest software developer and IT jobs in Pakistan, including remote jobs, or see all free tools.
Last reviewed 10 November 2026.