Tools

Home
JS ValidatorMinify CSSWord to HTMLStrip HTML
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

JSON Validator & Formatter

Paste JSON to validate, format with custom indentation, minify, or explore as a collapsible tree

Your files never leave your browser
Input
Output
Ready·0 characters, 0 lines

Paste raw or minified JSON here to validate, pretty-print with 2-space, 4-space, or tab indentation, minify for production, or browse nested structures in the collapsible tree view. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste Raw JSON
➔
Parse & Validate
➔
Formatted Output

The formatter runs JSON.parse() on your input to check validity first. If the syntax is broken, it tells you exactly which line and character caused the problem. Valid JSON gets re-serialized with JSON.stringify() using your chosen indentation. No libraries, no server calls — just native browser APIs doing the work.

Examples

Formatting an API Response

You grabbed a user object from a REST endpoint and it came back as one line.

INPUT
{"name":"Alice","age":29,"roles":["admin","editor"],"active":true}
OUTPUT
{ "name": "Alice", "age": 29, "roles": [ "admin", "editor" ], "active": true }

Minifying a Config File for Production

Your app config is readable during development but needs to be compact for deployment. Minify cuts 40% of the file size on a typical config.

INPUT
{ "database": { "host": "db.example.com", "port": 5432, "ssl": true }, "cache": { "ttl": 3600 } }
OUTPUT
{"database":{"host":"db.example.com","port":5432,"ssl":true},"cache":{"ttl":3600}}

Catching a Trailing Comma Bug

Something is off in your JSON but the error message from your app is useless. Paste it here to get the exact line number.

INPUT
{"items": ["a", "b", "c",]}
OUTPUT
❌ Error at line 1, column 25: Unexpected token ] — trailing commas are not valid JSON.

Who Uses This

👨‍💻 Developers

Debugging API responses and cleaning up webhook payloads before writing parsers.

📊 Data Analysts

Inspecting exported datasets and verifying structure before loading into pipelines.

🎓 Students

Learning JSON syntax by pasting examples and seeing how indentation reveals structure.

🛠️ DevOps Engineers

Validating Terraform outputs, Docker configs, and CI/CD pipeline definitions.

Common Mistakes

Trailing commas after the last item

JavaScript allows ["a", "b",] but JSON does not. Remove the comma after the final element in every array and object.

Using single quotes instead of double quotes

JSON requires double quotes around keys and string values. {'name': 'Alice'} is valid Python but invalid JSON. Switch every single quote to a double quote.

Pasting JavaScript objects instead of JSON

JS objects can have unquoted keys, comments, and functions. None of that is valid JSON. Strip out comments and wrap all keys in double quotes before pasting.

Technical Details

Frequently Asked Questions

What's the difference between JSON and a JavaScript object?

JSON is a strict text format — keys must be double-quoted, no trailing commas, no comments, no functions. A JavaScript object is looser: unquoted keys, single quotes, and comments are all fine. If you copy an object from your JS code, it won't parse as valid JSON until you fix those differences.

Can I format JSON with comments?

Standard JSON doesn't support comments at all. Some tools use "JSON5" or "JSONC" which allow them, but strict JSON parsers will reject anything with // or /* */. Remove all comments before pasting here.

Why does my JSON show an error on the first character?

Usually means there's an invisible character at the start of the text — a BOM (byte order mark) or a zero-width space copied from a rich text editor. Try deleting the first few characters and retyping them. That clears hidden characters most of the time.

Is there a size limit for JSON I can paste?

There's no hard limit on our end. Your browser handles the parsing, so it depends on how much memory you have. Files under 10 MB format instantly. Larger files might take a second or two. If your browser tab crashes, the file is probably too big — try splitting it first.

Is it safe to paste sensitive or private JSON data here?

Yes. The formatter runs entirely in your browser. Nothing is sent to a server, nothing is logged, and nothing gets stored. Once you close or refresh the tab, your data is gone. You can disconnect from the internet and it still works.

Share: