JSON Formatter
Paste JSON or open a local file to format it with two- or four-space indentation, remove unnecessary whitespace, or check its syntax. View color-highlighted JSON or explore objects and arrays in a bounded tree. The formatted and minified text preserves the original number digits.
How to Format JSON Online
Paste JSON into the Input JSON editor, or select Open file to read a local file. Choose Format to display an indented result below the input. The indentation menu offers two or four spaces.
The result appears as syntax-highlighted code, with different colors for property names, strings, numbers, and JSON literals. Use the Copy or Download icon above the result to export the formatted JSON. Example loads and formats a sample document immediately.
Validate JSON and Locate Syntax Errors
Select Validate to check the input against standard JSON syntax. Valid input displays a confirmation and a navigable tree preview. Invalid input displays the parser's error message, including line and column when the browser reports a reliable location.
Common errors include trailing commas, comments, single-quoted strings, and property names without double quotes. JSON also requires properly escaped characters inside strings.
Minify JSON Without Reserializing It
Select Minify to remove spaces, tabs, and line breaks outside quoted strings. Whitespace inside string values is preserved, because it is part of the data.
Minification produces compact JSON text; it is not gzip compression. The tool rewrites whitespace instead of parsing and serializing the document again, so large numeric literals keep their original digits.
Switch Between JSON Code and Tree View
After formatting or minifying, use the JSON and Tree controls above the result to switch views. The JSON view shows readable, color-highlighted code. The Tree view lets you expand objects and arrays to inspect individual entries.
To keep large documents manageable, the tree displays at most five levels, 50 entries in any expanded container, and 250 visible rows. These limits affect the preview, not the formatted output.
Preserving Large JSON Numbers
JavaScript's JSON.parse represents JSON numbers as JavaScript Number values. Integers larger than 9,007,199,254,740,991 can lose precision when converted to that type.
This formatter validates with JSON.parse but does not use JSON.stringify to produce the formatted or minified text. For example, 9007199254740993 remains 9007199254740993 in the result, copied text, and downloaded file. The tree preview can display a rounded value, so use the JSON view when exact digits matter.
Format Local JSON Files Privately
Open file reads a selected file in the browser without uploading it to Olivez. Files are limited to 1,000,000 bytes, and the decoded input cannot exceed 1,000,000 UTF-16 code units.
The Copy action writes the output to the system clipboard; Download saves a .json file through the browser. As with other clipboard and downloaded content, storage and access depend on your device and browser settings.
Examples
Pretty-print a JSON object
1Input
{"name":"Olivez","active":true,"tags":["json","tools"]}
Show result
Result
{ "name": "Olivez", "active": true, "tags": [ "json", "tools" ] }
Format uses two spaces in this example. You can also select four spaces.
Minify an array
2Input
[ 1, 2, { "enabled": true } ]
Show result
Result
[1,2,{"enabled":true}]
Only whitespace outside strings is removed.
Preserve a large integer
3Input
{"id":9007199254740993}
Show result
Result
{ "id": 9007199254740993 }
The JSON text retains these digits, even though the tree viewer may round the number.
Find an invalid trailing comma
4Input
{"name":"Olivez",}
Show result
Result
Invalid JSON: the trailing comma must be removed.
The exact parser message and availability of line and column vary by browser.
Frequently Asked Questions
Is this JSON formatter free?
Yes. You can format, minify, validate, inspect, copy, and download JSON without an account.
Does formatting change JSON values?
The formatted output changes whitespace outside strings without rewriting property names, strings, or numeric literals. The tree preview is a separate parsed representation.
Does the formatter preserve large integers?
Yes, in the formatted and minified JSON text. The tree viewer uses JavaScript numbers and may round integers outside the safe-integer range.
Can I validate JSON without formatting it?
Yes. Select Validate to check the syntax and inspect the resulting tree. It does not create a separate formatted text result.
Why doesn't my error show a line and column?
JSON parser messages differ across browsers. The tool displays a location when one can be determined reliably; otherwise it shows the parser message without inventing a position.
Can I open a JSON file?
Yes. Use Open file to read a local file of up to 1,000,000 bytes. The decoded content must also fit the input-length limit.
Can I expand objects and arrays in the output?
Yes. After a valid result, select Tree to expand objects and arrays. The preview is capped to prevent excessively large trees from rendering.
Does it support comments or trailing commas?
No. The formatter accepts strict JSON only, not JSON5, JavaScript object literals, comments, or trailing commas.
Is my JSON uploaded to Olivez?
No. The tool processes pasted and opened JSON locally in the browser. Copying and downloading use your browser and operating system.