JSON Formatter and Validator: Beautify, Minify, Fix Errors
Paste JSON into this JSON formatter to make it readable in one click. It indents and lines up nested objects, can minify JSON for production, sort keys alphabetically, and acts as a JSON validator that points to the exact line and column of any syntax error.
Everything runs in your browser. Nothing you enter is sent to or stored on our server.
Quick answer: Paste your JSON and click Format. Valid JSON is shown neatly indented below; invalid JSON gets an error message with the line and column, and the cursor jumps to the problem.
How to use the JSON formatter
- Paste JSON from an API response, a config file or a log into the input box.
- Choose 2 spaces, 4 spaces or tabs for indentation, and tick Sort keys A-Z to compare two objects more easily.
- Click Format to beautify or Minify to remove all spaces and line breaks.
- Click Copy result.
JSON validator: common errors and fixes
| Error | Fix |
|---|---|
Trailing comma: {"a":1,} | Remove the comma after the last item. |
Single quotes: {'a':1} | JSON only allows double quotes for keys and strings. |
Unquoted keys: {a:1} | Put every key in double quotes: {"a":1}. |
Comments: // note | Standard JSON has no comments. Remove them (JSONC and JSON5 allow them, JSON.parse doesn’t). |
Special values: NaN, undefined | Use null or a string instead. |
| Missing bracket or brace | Every [ and { needs a matching closing one. Format a smaller piece to find it. |
What is JSON?
JSON (JavaScript Object Notation) is the most common format for sending data between apps and servers. It has objects in curly braces, arrays in square brackets, and values that are strings, numbers, true, false or null. Its rules are defined in RFC 8259. Because JSON is plain text, a missing comma or quote breaks the whole file, which is why a validator is useful.
Format JSON on the command line and in editors
- jq:
jq . file.jsonformats;jq -c .minifies. - Python:
python -m json.tool file.json - VS Code: Shift+Alt+F (Windows) or Shift+Option+F (Mac) in a .json file.
- Chrome and Firefox: opening a JSON URL shows a formatted viewer.
Privacy
JSON often contains API keys, tokens and personal data. This formatter runs entirely in your browser with the built-in JSON.parse, so nothing is uploaded. Still, remove secrets before sharing formatted output with anyone.
Need to decode a Base64 field inside your JSON? Use the Base64 decoder. To compare two JSON files, format both with sorted keys and paste them into our diff checker.
FAQ
Is there a size limit?
Files of several megabytes work. Very large files depend on your device’s memory.
Does minifying change my data?
No. It only removes spaces and line breaks outside strings.
More free tools
See all of them on the QuickOnlineTips free online tools page and play our free online games.
