JSON Formatter: Pretty Print & Minify JSON
Format JSON with pretty print, minify, and custom indentation. Transform JSON between readable and compact formats. Free, no registration required.
Last updated: March 2026 • Formats: Pretty-print, Minify, Sort Keys
What is JSON Formatting?
JSON formatting transforms JSON between two main states:
Pretty-Printed JSON: Readable, indented, with line breaks. Easy for humans to read and edit.
Minified JSON: Compact, no whitespace, single line. Ideal for APIs, file storage, and transmission.
JSON Visualiser lets you switch between formats instantly, with options for indentation size, key sorting, and more.
Formatting Options
Pretty Print (Beautify)
Transform compact JSON into readable, indented format:
Options:
- Indentation: 2, 4, or custom number of spaces
- Sort keys: Alphabetical or preserve order
- Add trailing newlines: Yes or no
- Space after colons: Yes or no
Minify (Compress)
Transform readable JSON into compact format:
Benefits:
- Smaller file size (up to 40% reduction)
- Faster transmission over network
- Ideal for API responses
- Reduces storage requirements
Sort Keys Alphabetically
Reorder object keys alphabetically for consistency:
Benefits:
- Easier to find keys visually
- Consistent order across files
- Better for diff comparisons
- Git-friendly
How to Format JSON
Step 1: Open JSON Visualiser
Navigate to the JSON Visualiser homepage. No sign-up required.
Step 2: Paste or Type JSON
Paste your JSON into the editor, or type directly. Monaco editor provides syntax highlighting.
Step 3: Choose Format Option
Use the formatting toolbar:
- Pretty Print: Add indentation and line breaks
- Minify: Remove all whitespace
- Sort Keys: Alphabetically reorder object keys
- Custom Indent: Choose 2, 4, or custom spaces
Step 4: Copy or Export
Copy the formatted JSON to your clipboard, or use the tree view to explore the structure.
Format Examples
Configuration Files
Pretty-print configuration files for readability:
API Responses
Minify API responses for faster transmission:
Data Export
Sort keys for consistent data exports:
Indentation Options
2 Spaces (Default)
Compact but readable:
Best for: Most use cases, modern coding standards
4 Spaces
More indentation, clearer nesting:
Best for: Very nested JSON, learning purposes
Tabs (Tab Character)
Uses actual tab characters:
Best for: Editor-specific preferences, legacy systems
Pretty Print vs. Minify
Formatting Best Practices
For Human Readers
Use pretty-print formatting:
- Indentation: 2 or 4 spaces
- Sort keys alphabetically
- Add trailing newlines
- Space after colons for readability
For APIs & Storage
Use minified formatting:
- Remove all whitespace
- Skip key sorting (preserve order)
- No trailing newlines
- Minify before network transmission
For Version Control
Use consistent formatting:
- Same indentation across files
- Sort keys alphabetically
- Use pretty-print for diffs
- Run linters to enforce format
For JSON Patches & Diffs
Use pretty-print with consistent order:
- Easier to see what changed
- Smaller diffs when consistent
- Better for code reviews
Bulk Formatting
Format multiple JSON files:
Or paste multiple JSON objects into JSON Visualiser and format them one by one.
Advanced Formatting
Preserve Order
JavaScript objects maintain key insertion order (ES2015+). By default, JSON Visualiser preserves this order unless you choose to sort keys.
Unicode Characters
JSON supports Unicode characters in strings. Pretty-printing doesn't escape Unicode by default, but you can choose to escape for specific use cases.
Special Characters
Pretty-printing handles special characters correctly:
- Newlines in strings:
\n - Tabs in strings:
\t - Quotes:
\"or\' - Backslashes:
\\
Date Formatting
JSON has no native date type. Dates are typically strings in ISO 8601 format:
Formatting in Different Languages
JavaScript
Python
PHP
Format, pretty-print, and minify JSON instantly. No registration, instant load, and multiple formatting options for every use case.
References: JSON.stringify() documentation, Python json module, PHP json_encode().