JSON Formatter & Compressor
Professional online JSON parser, formatter, validator, and minifier
Formatted Result
How to Use
Simple Steps:
- Paste your JSON string into the input box on the left.
- Click 'Format' to beautify the structure, or 'Minify' to remove whitespace.
- If the JSON has syntax errors, try clicking the 'Auto Fix' button.
- Click the 'Copy' button in the top right of the result area to copy to clipboard.
Escape Output Example
When 'Escape Output' is enabled, the result becomes a stringified JSON, suitable for embedding in code.
Normal Output
{ "message": "Hello \"World\"", "newline": "Line 1\nLine 2" }Escaped Output
{\n \"message\": \"Hello \\\"World\\\"\",\n \"newline\": \"Line 1\\nLine 2\"\n}Key Features
- Syntax Highlighting: Different colors for different data types.
- Error Detection: Real-time validation of input JSON syntax.
- Auto Fix: Attempts to fix common JSON errors (e.g., single quotes, trailing commas).
- Minification: Removes all unnecessary whitespace to reduce size.
- Escaping/Unescaping: Convenient for use in Java/JS strings.
- Dark Mode: Eye-friendly color scheme.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is based on a subset of the JavaScript Programming Language. JSON is easy for humans to read and write, and it is easy for machines to parse and generate.
JSON Syntax Rules
- Data is in name/value pairs
- Data is separated by commas
- Curly braces hold objects
- Square brackets hold arrays
- Keys must be wrapped in double quotes
JSON Data Types
| Type | Description | Example |
|---|---|---|
| String | A sequence of Unicode characters wrapped in double quotes | "Hello World" |
| Number | Integer or floating point | 42, 3.14 |
| Object | Unordered set of key/value pairs | {"name": "John"} |
| Array | Ordered list of values | [1, 2, 3] |
| Boolean | true or false | true |
| null | Empty value | null |
Common Issues
Why is my JSON always erroring?
The most common reasons are keys not being in double quotes (allowed in JS objects, but not JSON) or trailing commas.
Can I use single quotes?
No. The standard JSON specification mandates double quotes.
More info: JSON.org | RFC 8259 | Wikipedia: JSON