JSON Formatter and Beautifier
Paste JSON, drop a file or load a URL, and get clean, indented JSON as you type. Errors point to the exact line and column, and almost-JSON from LLMs or config files can be fixed in one click. One of our free JSON tools.
Input
Output
How to format JSON
- Step 1
Add your JSON
Paste it, drop a .json file on the input panel, open a file, or load a URL with your browser.
- Step 2
Pick a style
Choose Beautify with 2 spaces, 4 spaces or tabs, or Minify. Tick Sort keys for stable, diff-friendly output.
- Step 3
Copy, download or send it on
Copy the result, download formatted.json, or send it to JSON to TypeScript, Zod or CSV.
Worked example
{"id":"ord_8f2c","total":129.5,"customer":{"name":"Priya"},"items":[{"sku":"KB-01","qty":1}],"shipped":false} {
"id": "ord_8f2c",
"total": 129.5,
"customer": {
"name": "Priya"
},
"items": [
{
"sku": "KB-01",
"qty": 1
}
],
"shipped": false
} What formatting changes, and what it doesn't
The formatter parses your text into a value and prints it again with consistent whitespace. Strings, numbers, booleans and nulls come out exactly as they went in, and keys keep the order you wrote them in. Two things can look different afterwards, and both come from how JSON is read rather than from the formatter.
First, keys that look like whole numbers, such as "2" or "10", move to the front of their object in numeric order, because that is how JavaScript stores object keys. Second, JSON numbers are read as 64-bit floating point, which is exact only up to 9,007,199,254,740,991. A 20-digit ID such as 12345678901234567890 comes back as 12345678901234567000. If your data has 64-bit IDs, keep them as strings. Escape sequences are also printed in their plain form, so "café" becomes "café", which is the same string.
Choosing an indent
Two spaces is the most common style and what JSON.stringify(value, null, 2) produces. Four spaces is common in Python projects, and tabs let each reader pick their own width. Tick Sort keys to order every object's keys alphabetically at every level. Sorted output is handy before committing fixtures or comparing two API responses, because the same data always prints the same way.
Reading error messages
When the JSON is invalid, the output panel names the problem in plain words and gives its line and column. The line is also highlighted in the input's line-number gutter, and Show in input puts your cursor on the exact character. The messages are the same in every browser because SyntaxSnap uses its own checker to locate the error instead of relying on each browser's wording. A missing comma is usually reported where the next key starts, so look at the end of the line before. For a full list of every problem at once, use the JSON validator.
Fixing almost-JSON
Output from ChatGPT, Claude and other LLMs often arrives inside a markdown code fence with a sentence before it. JavaScript configs use comments, single quotes and unquoted keys, and Python prints True, False and None. Fix common errors handles all of these, adds missing commas, removes trailing ones, closes brackets left open by truncated output, and wraps several concatenated objects in an array. The button only appears when the repaired text is valid JSON. If you just need to read a tsconfig.json or VS Code settings file, tick Allow comments (JSONC) instead and the input is accepted as it is.
Large files
You can open files up to 50 MB. Anything over 1 MB is parsed in a Web Worker, a background thread in the same tab, so the editor keeps responding while it works. The output pane shows the first 400 KB of very large results to keep scrolling smooth; Copy and Download always give you the full text.
Why format JSON locally
API responses often contain access tokens, email addresses and customer records. Many online formatters send what you paste to their server. Here the work happens in your browser tab, and you can check it yourself: open the network tab in your browser's developer tools, then format something. No request is made.
Questions and answers
Is my JSON sent to a server?
No. Formatting uses your browser's built-in JSON parser, and files over 1 MB are handled by a Web Worker in the same tab. You can confirm it in the network tab of your browser's developer tools: formatting makes no requests.
How big a file can it format?
You can open files up to 50 MB. Anything over 1 MB is parsed in the background so the editor keeps responding. The output pane shows the first 400 KB of very large results, and Copy and Download always give you the full text.
Why did a long number change after formatting?
JSON numbers are read as 64-bit floating point, which is exact only up to 9,007,199,254,740,991. A value like 12345678901234567890 comes back as 12345678901234567000. If you work with 64-bit IDs, store them as strings in your JSON.
Why did the key order change?
It only changes for keys that look like whole numbers, such as "2" or "10". JavaScript lists those keys first, in numeric order, before all other keys. Text keys keep the order you wrote them in unless you tick Sort keys.
Can it fix JSON returned by ChatGPT or Claude?
Usually. Fix common errors removes markdown code fences and surrounding sentences, strips comments, removes trailing commas, adds missing commas, converts single quotes, quotes bare keys and turns True, False and None into JSON literals. It only offers the fix when the result is valid JSON.
Related tools
All JSON & Schema toolsNext step
Need this built into your stack?
The team behind SyntaxSnap builds custom code generators, internal developer tools and API integrations.