JSON Formatter & Validator
Format, minify, and validate JSON online.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. Originally derived from JavaScript object syntax, JSON is now language-independent and supported natively by virtually every programming language and API.
A valid JSON document is one of:
- An object:
{"key": "value", "count": 42} - An array:
[1, "two", true, null] - A primitive: string, number, boolean, or
null
Common Use Cases
- API responses β REST and GraphQL APIs exchange data as JSON
- Configuration files β
package.json,tsconfig.json, VS Code settings - Data storage β NoSQL databases like MongoDB store JSON documents
- Log files β Structured logging for easier parsing and searching
- Inter-service communication β Microservices pass events and payloads as JSON
How to Use This Tool
- Paste your JSON into the Input box (or type it from scratch).
- Click Format to pretty-print it with your chosen indent size (2 spaces, 4 spaces, or tabs).
- Click Minify to compress the JSON to a single line β useful for reducing payload size.
- Click Validate to check whether the input is syntactically correct without changing it.
- Copy the output with one click.
Your data is never sent to a server.
Frequently Asked Questions
Why is my JSON invalid?
The most common mistakes are:
- Trailing commas:
{"a": 1,}is invalid (JavaScript allows them, JSON does not) - Single quotes: JSON requires double quotes for strings β
'hello'is invalid - Unquoted keys:
{key: "value"}is not valid JSON β keys must be quoted:{"key": "value"} - Comments: JSON has no comment syntax β
// commentwill cause a parse error undefined: JSON supportsnullbut notundefined
What is the difference between Format and Minify?
Format (pretty-print) adds whitespace and newlines to make the JSON human-readable. Minify removes all unnecessary whitespace to reduce the byte size, which is useful when transmitting JSON over a network.
What indent size should I use?
2 spaces is the most common convention (used in most JavaScript/Node.js projects). 4 spaces is common in Python and Java codebases. Tabs are used in some style guides (e.g. Go). For machine consumption it makes no difference β use what your projectβs style guide requires.
Is this tool safe to use with sensitive data?
Yes. The tool uses the native JSON.parse and JSON.stringify APIs.
Can I format very large JSON files?
The tool works with any size of JSON. For extremely large files (tens of MB), processing may slow down, but there is no artificial limit imposed by the tool.