Developer · JSON Tool
JSON Formatter
& Validator
Paste messy JSON and get it instantly formatted, syntax-highlighted, and validated. Supports minify, tree view, key sorting, and clipboard copy.
JSON Syntax Rules
Keys must be double-quoted strings. Values can be strings, numbers, booleans (true/false), null, arrays [], or objects {}. No trailing commas. No comments. Numbers can be integers or floats, not quoted.
Common JSON Errors
Most errors are: trailing commas after the last item, single-quoted strings (must be double-quoted), undefined or NaN values (not valid JSON), unescaped special characters in strings, and missing colons between keys and values.
JSON vs JSONC
Standard JSON doesn't allow comments. JSONC (JSON with Comments) is used in some config files (VS Code settings.json, tsconfig.json). This formatter handles standard JSON — strip comments before pasting JSONC. Use // comment removal with a text editor first.
Performance Tip
For very large JSON files (1MB+), browser-based formatting can be slow. Consider using jq on the command line: cat file.json | jq . for instant pretty-printing. jq is pre-installed on most Linux/macOS systems.
Why is my JSON invalid? ▾
The most common causes: trailing commas (JSON doesn't allow them after the last item in an object or array), single quotes instead of double quotes for strings, unquoted keys, and JavaScript-specific values like undefined, NaN, or Infinity which aren't valid JSON. The error message in the status bar pinpoints the exact line and position.
What's the difference between JSON and JavaScript objects? ▾
JSON is a text format, JavaScript objects are runtime values. JSON requires double-quoted keys and string values, no trailing commas, no comments, no functions, and no undefined/NaN/Infinity. JavaScript object literals are more permissive. JSON.stringify() converts JS objects to JSON; JSON.parse() converts JSON strings back to JS objects.
Is my JSON data secure here? ▾
Yes — all processing happens entirely in your browser. Your JSON is never sent to any server. This tool uses only JavaScript running locally in your tab. You can safely paste sensitive configuration files or API responses.
Frequently Asked Questions
What does 'invalid JSON' mean? ▾
JSON has strict syntax rules. Common errors: trailing commas after the last item in an array or object (valid in JS but not JSON), single quotes instead of double quotes around strings, unquoted property names, undefined or NaN values (not valid in JSON), and comments (JSON has no comment syntax). Paste your JSON here and the validator will highlight the exact line causing the error.
What is the difference between JSON and JavaScript objects? ▾
JSON (JavaScript Object Notation) looks similar to a JS object but is stricter: all property names must be double-quoted strings, values can only be strings, numbers, booleans, null, arrays, or objects — no functions, dates, undefined, or NaN. JSON is a text format for data exchange, not executable code. Use JSON.parse() to convert JSON text to a JS object and JSON.stringify() to go the other way.
What does 'minify' JSON do? ▾
Minifying removes all whitespace (spaces, tabs, newlines) that isn't inside a string value. It makes the JSON smaller for network transmission — a large formatted JSON file can be 30–50% larger than its minified equivalent. Use formatted JSON for debugging and configuration files; use minified JSON for API responses and production data transfers to save bandwidth and reduce load times.
What is JSON Schema? ▾
JSON Schema is a vocabulary for validating the structure of JSON data. It lets you define required fields, data types, value ranges, and patterns. For example, you can specify that an 'age' field must be a number between 0 and 120. It's widely used in APIs, configuration validation, and form builders. Tools like ajv (JavaScript) and jsonschema (Python) can validate data against a schema at runtime.
Can JSON contain comments? ▾
Standard JSON cannot contain comments — this is by design to keep it a simple data-interchange format. However, some tools accept JSON5 (a superset of JSON that allows // and /* */ comments) or JSONC (JSON with Comments, used by VS Code for config files). If you need comments in config files, consider YAML or TOML which both natively support them. Never include comments in API payloads.
How to Use the JSON Formatter
Format, validate, and minify JSON instantly — with error highlighting and line numbers.
01
Paste your JSON
Paste raw JSON into the input panel. It can be minified (all on one line), formatted, or broken — the tool handles all cases.
02
Format it
Click 'Format' or press Ctrl/Cmd+Enter. The JSON is indented with 2-space or 4-space indentation (your choice) for easy reading.
03
Fix errors
If the JSON is invalid, the error panel highlights the exact line and character where the problem is. Common issues: trailing commas, missing quotes on keys, unclosed brackets.
04
Validate
The validator confirms whether the JSON is syntactically valid. Green means valid; red explains the specific error.
05
Minify for production
Minify removes all whitespace to create the smallest possible JSON string — useful before pasting into code or APIs.
💡💡 JSON k
✅Free forever — no subscription, no API key
🔗Backlink credit drives referral traffic to you
🔒Files never uploaded — GDPR/CCPA friendly
📱Fully responsive — works on mobile and desktop
✓ Link copied to clipboard