JSON Formatter & Validator

Format, validate, and minify JSON data with syntax highlighting.

Input JSON
What is This Tool?

JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy to read and write. This tool formats messy JSON into readable indented output, validates it for syntax errors, and can minify it to reduce file size.

Formula
JSON structure rules: - Objects: { "key": value } - Arrays: [ value1, value2 ] - Values: string, number, boolean, null, object, array - Strings must use double quotes - No trailing commas allowed
Worked Examples

1. Format compact JSON

Given: {"name":"John","age":30,"city":"NYC"}

Parse the JSON string

Re-serialize with 2-space indentation

Result: Formatted JSON with proper line breaks and indentation

2. Validate broken JSON

Given: {name: "John"}

Parser detects missing quotes around key 'name'

Reports: Expected double-quoted property name

Result: Error: Invalid JSON - keys must be quoted

3. Minify formatted JSON

Given: Multi-line formatted JSON (500 bytes)

Remove all whitespace and newlines

Output single line

Result: Compact JSON (200 bytes, 60% smaller)

Frequently Asked Questions