JSON formatter
JSON(JavaScript Object Notation) data exchange format. JSON formatter prettifies compressed JSON with indentation and line breaks, or removes unnecessary whitespace to compress. Essential for API response analysis, config file editing, database record inspection, and debugging.
Key features
Prettify
Format compressed JSON with 2/4 space or tab indentation
Minify
Remove whitespace and line breaks to minimize file size
Validation
Detect JSON syntax errors with specific location and cause
Real-time
Auto-format as you type (300ms debounce)
JSON rules
- Keys must be wrapped in double quotes (single quotes not allowed)
- String values use double quotes; numbers/booleans/null without quotes
- No trailing commas after last item
- No comments (JSON5, JSONC support them)
FAQ
JSON and JavaScript object difference?▼
JSON is a data exchange format requiring double-quoted keys and does not support functions/undefined/comments. JavaScript objects are more flexible but must follow rules when serialized to JSON.
How many spaces for indentation?▼
No official standard. 2 spaces is most common, 4 spaces also popular. Follow your project coding convention.
How to add comments to JSON?▼
Standard JSON does not support comments. For config files, use JSONC (JSON with Comments) or JSON5 format, or use a "_comment" key as workaround.