JSON Formatter - Beautify, Validate, and Minify JSON
Format, validate, or minify JSON payloads, sort object keys, escape Unicode characters, and strip JSONC comments.
Converting a plain text column into a JSON array instead? Use our Delimited List Converter.
🔒 Data Safety: We process everything securely and never store or share it.
How to Use
- Paste or type your JSON payload into the box above, or open or drop a local .json file.
- Choose an indentation style and check any key-sorting, Unicode, or cleanup options below the box.
- Press "Format" to check RFC 8259 syntax and output an indented or single-line JSON document.
- Use "Copy" for instant clipboard access or "Download" to save the output as a .json file.
Options Explained
- Indentation: Indent nested objects and arrays with "2 Spaces", "4 Spaces", or "1 Tab (\t)". Pick "Minify (1 Line)" to collapse formatting spaces and line breaks into one compact JSON string.
- Sort Keys: Sort property names from A to Z across every nested JSON object for cleaner comparisons. Leave it unchecked to keep your original key order, including numeric object keys.
- Escape Unicode (\uXXXX): Convert non-ASCII characters and emojis into lowercase \uXXXX escape sequences for ASCII-only parsers and gateways. When unchecked, valid \uXXXX escapes decode into readable UTF-8 text while keeping lone surrogates escaped.
- Allow Comments & Trailing Commas: Strip // line comments, /* */ block comments, and trailing commas before closing } or ] brackets. Keep this option off when you want strict validation against standard JSON syntax rules.
Key Features
- Beautify nested JSON with 2 spaces, 4 spaces, or 1 tab, or minify into a single line.
- Report the exact line and column of syntax mistakes such as unquoted keys, single quotes, missing commas, or unclosed brackets.
- Preserve 64-bit integers, negative zero (-0), and trailing decimal zeros like 19.90 without floating-point rounding.
- Keep original numeric key order and flag duplicate object keys, or sort keys alphabetically across nested objects.
- Clean optional JSONC comments and trailing commas, ignore leading UTF-8 BOM bytes, and decode or escape Unicode characters.
- Parse deeply nested JSON structures in browser RAM and save clean outputs directly as .json files.
About This Online JSON Formatter
This JSON formatter parses, indents, and minifies structured data under strict RFC 8259 rules. Rather than relying on native JavaScript float parsing, its token engine preserves 64-bit integers, trailing decimal zeros, numeric key order, and duplicate keys verbatim.
Developed and maintained by the PU Tools team, this tool gives you fast, accurate, safe, and easy results in just a few clicks.
Common Use Cases
- API Response Debugging: Expand minified REST or webhook payloads into indented blocks to inspect nested objects and arrays.
- Config File Cleanup: Strip comments and trailing commas from JSONC or editor settings files to produce strict JSON.
- Git Diff Normalization: Sort object keys alphabetically across configuration exports so version-control diffs highlight real value changes.
- Payload Minification: Minify formatted JSON into a single line and escape Unicode characters for HTTP headers or logs.
Example Input and Output
Example Input
{"order_id":9223372036854775807,"customer":"Café Crème","city":"Montréal","total":19.90,"paid":true,"items":[" Croissant ","Espresso 🚀"],"notes":null}
Options used: Indentation: 2 Spaces | Sort Keys: OFF | Escape Unicode (\uXXXX): OFF | Allow Comments & Trailing Commas: OFF
Example Output
{
"order_id": 9223372036854775807,
"customer": "Café Crème",
"city": "Montréal",
"total": 19.90,
"paid": true,
"items": [
" Croissant ",
"Espresso 🚀"
],
"notes": null
}
The formatter indents nested fields with two spaces, preserving the 64-bit integer, 19.90 decimal, accents, and emoji.
Frequently Asked Questions
Why do some JSON formatters change large 64-bit numbers or strip trailing zeros?
Standard JavaScript JSON.parse() converts every number into a 64-bit float, rounding integers above 9007199254740991. This formatter keeps validated number tokens as raw text, preserving 64-bit IDs and 19.90 decimals.
Can I format JSON files that contain comments or trailing commas?
Yes, check "Allow Comments & Trailing Commas" below the input box before clicking "Format". The parser strips line comments, block comments, and trailing commas before closing brackets into valid JSON.
Does this tool reorder numeric object keys or delete duplicate keys?
No, when "Sort Keys" is off, the formatter preserves your exact original key order, including numeric keys. Duplicate keys in the same object also remain intact with a warning note above the output.
What does the "Escape Unicode (\uXXXX)" option do to accented text and emojis?
Enabling "Escape Unicode (\uXXXX)" converts non-ASCII letters and emojis into lowercase \uXXXX escape sequences. Leaving it unchecked outputs readable UTF-8 characters while keeping unpaired surrogate escapes safely encoded.
How is this JSON formatter different from the Delimited List Converter?
This formatter validates, indents, or minifies existing JSON objects, nested arrays, and key-value structures. To turn a plain column or comma-separated list into a JSON array, use our Delimited List Converter.
Are my API payloads or JSON configuration files sent to any server?
No, all JSON parsing, syntax validation, and formatting run locally inside your browser memory. Your API responses, tokens, and configuration files stay on your device with zero server storage.