JSON Formatter
Paste any JSON into this formatter to instantly see a clean, readable version with proper indentation. The validator shows exactly where syntax errors are so you can fix them fast. Use the minify option to strip whitespace for production use. Your data never leaves your browser.
How to use this tool
- 1Paste your JSON into the input box. The formatter validates it instantly and shows whether it is valid or invalid.
- 2If the JSON is valid, the formatted (beautified) version appears with proper indentation and line breaks.
- 3Click 'Copy formatted' to copy the readable version, or 'Copy minified' to copy the compact version without whitespace.
- 4If the JSON is invalid, the error message shows the exact location of the problem so you can fix it and try again.
- 5Check the size stats to see how much space the formatted and minified versions take - useful when optimising API payloads.
Example
Copy a raw API response like {"id":1,"name":"Jane Doe","email":"jane@example.com","active":true} and paste it here. The formatter outputs a readable version with each key on its own line. A nested object with 20 keys that arrives as one long line becomes immediately readable after formatting.
Missing a closing bracket or a trailing comma in a config file? Paste the JSON and the validator pinpoints the line and column of the error - for example 'Unexpected token at line 4, column 12' - rather than leaving you to scan hundreds of lines manually.
Common use cases
- Developers reading an API response that arrived as a single compressed line
- Technical freelancers debugging webhook payloads or third-party data feeds
- Anyone editing a JSON config file who wants to check it is valid before saving
- Product managers and analysts who receive JSON data and need to read it without a code editor
- Developers minifying JSON before storing it in a database or sending it in a request body
Common mistakes
- Using single quotes instead of double quotes for keys and string values - JSON requires double quotes; single quotes cause a parse error even though many programming languages accept them.
- Leaving a trailing comma after the last item in an object or array - trailing commas are valid in JavaScript but not in strict JSON and will cause a parse error.
- Forgetting to escape special characters inside strings - backslashes, double quotes, and newlines must be escaped (e.g. \n for newline, \" for a quote inside a string).
- Assuming formatted JSON is always valid - formatting only works on valid input; the validator tells you whether the JSON is actually correct.
Frequently asked questions
What is JSON?
JSON stands for JavaScript Object Notation. It is a lightweight text format used to store and exchange data between systems. JSON is built on two structures: objects (key-value pairs in curly braces) and arrays (ordered lists in square brackets). It is the most common data format used by web APIs.
What is the difference between formatting and minifying JSON?
Formatting (beautifying) adds indentation and line breaks to make JSON readable for humans. Minifying removes all unnecessary whitespace to produce the smallest possible file. Use formatted JSON when editing or debugging; use minified JSON in production to reduce file size and bandwidth.
Is my JSON data sent to a server?
No. All formatting and validation happens entirely in your browser using the built-in JSON.parse function. Your data is never sent to any server, stored, or logged. You can safely paste API keys, private configuration, or sensitive data.
Why does my JSON fail to parse even though it looks correct?
The most common hidden causes are: trailing commas after the last item, single quotes instead of double quotes, unescaped special characters inside strings, and invisible Unicode characters copied from a document editor. The error message shows the exact line and column to help you find the issue.
What is the difference between JSON and JavaScript objects?
JSON is a strict subset of JavaScript object syntax with extra rules: all keys must be double-quoted strings, and values can only be strings, numbers, booleans, null, objects, or arrays. JavaScript objects allow unquoted keys, single quotes, functions, and undefined - none of which are valid in JSON.
How much does minifying JSON reduce file size?
It depends on the amount of indentation and whitespace. A formatted JSON file with 4-space indentation often minifies to 30-50% of its original size. Deep nesting produces more whitespace and therefore larger savings. The size stats shown by this tool give the exact before-and-after figures for your specific data.
Can I use this for JSONL (JSON Lines) format?
JSONL is a format where each line is a separate JSON object, not a single JSON document. This formatter parses one JSON document at a time. If you have a JSONL file, paste and format each line individually.
Related tools
Last updated