How to use JSON Formatter
- 1Paste JSON into the input, drop a .json file onto it, or click Open file.
- 2If it is invalid, read the error with its line and column, click Show in editor to jump there, or click Fix automatically when offered.
- 3When it is valid, choose Beautify or Minify, an indent of 2 spaces, 4 spaces or tabs, and Sort keys if you want keys in A to Z order.
- 4Switch to Tree view to explore nested data, then Copy, Download or Use as input.
Clear error messages
Browser error messages like Unexpected token } in JSON at position 214 are hard to act on. This validator reports the line and column, shows the line with a marker under the problem, and explains common causes in plain words: a missing comma, a trailing comma, single quotes, unquoted keys, comments, Python's True and None, or an unescaped line break inside a string.
One-click fixes
Fix automatically repairs the most common reasons JSON copied from JavaScript, config files or Python is rejected: it removes // and /* */ comments and trailing commas, adds double quotes around keys, converts single-quoted strings, and changes True, False and None to true, false and null. Text inside strings is never changed. Review the result before using it.
Tree view, sorting and privacy
The tree view lets you fold and unfold objects and arrays; hover any value to see its path, such as $.users[0].email. Sort keys orders every object's keys alphabetically, which makes two JSON files much easier to compare.
Everything runs in your browser, so API responses, tokens and customer data are never uploaded. Note that numbers with 16 or more digits cannot be stored exactly in JavaScript; the tool warns you when it sees them.
Frequently asked questions
How do I find the error in my JSON?
Paste it here. The error box shows the line and column, highlights the spot, and Show in editor selects it in the input.
Why is a trailing comma invalid in JSON?
The JSON standard does not allow a comma after the last item in an object or array, even though JavaScript does. Fix automatically removes them.
Can JSON have comments?
No. Standard JSON does not allow comments. Files like tsconfig.json use JSONC, a variant with comments; Fix automatically strips them.
Is it safe to paste API keys or private data?
Yes. The JSON is processed in your browser and never sent to a server.
What does minify do?
It removes all spaces and line breaks to make the JSON as small as possible, for example for API payloads or config values.