How to format JSON
- Paste your JSON into the Your JSON box.
- Choose the indentation: 2 spaces, 4 spaces or a tab.
- Click Format (or press Ctrl+Enter, or Cmd+Enter on a Mac). The formatted result appears in the Result box and a message confirms that the JSON is valid.
- Click Minify instead to remove all spaces and line breaks that are not needed, which gives the smallest possible text for sending or storing.
- Click Copy result to put the output on your clipboard.

Find errors by line and column
If the text is not valid JSON, the message tells you the line and column of the first problem and describes it in plain words, for example Expected "," or "}" after a property value or Trailing comma before "]" is not allowed in JSON. Below the message, the line is shown with the problem character highlighted, and the same character is selected in the input box so you can fix it straight away. Only the first error is reported, because everything after it cannot be read reliably; fix it and click Format again to find the next one.
The most common mistakes are:
- A trailing comma after the last item:
[1, 2, 3,] - Single quotes instead of double quotes:
{'name': 'Ana'} - Property names without quotes:
{name: "Ana"} - Comments, which standard JSON does not allow at all
- Values such as
undefined,NaNor a leading zero like007, which are not valid JSON numbers or values
Some configuration formats, such as JSON5 or files with comments used by certain editors, accept these extensions. This tool follows the strict JSON standard (RFC 8259), which is what APIs and JSON.parse expect.
A quick example
This minified input:
{"user":{"id":7,"roles":["admin","editor"]},"active":true}
becomes, with 2-space indentation:
{
"user": {
"id": 7,
"roles": [
"admin",
"editor"
]
},
"active": true
}
Sort keys
Tick Sort keys A to Z to rearrange the keys of every object, at every level, alphabetically. This makes two JSON documents much easier to compare, for example with the text diff checker. Arrays keep their order, because the order of array items is meaningful. Keys that look like whole numbers, such as "1" or "42", are always placed first by JavaScript, so they come before other keys. Unusual keys, including one literally named "__proto__", are kept as ordinary keys.
Limitations
Numbers in JSON are read as JavaScript numbers, which store about 15 to 17 significant digits. Integers larger than 9,007,199,254,740,991, such as some database IDs, and decimals with very many digits can therefore change slightly when formatted. The tool detects such numbers and shows a warning; if you need the exact value, store it as a string in your JSON. If an object contains the same key twice, only the last value is kept, as in every standard JSON parser. Very large files are limited by the memory of your device, and formatting several megabytes of JSON may take a moment.
Privacy
Your JSON is processed by JavaScript in your browser and is never uploaded, so it is safe to use with API responses, configuration files or other private data. Nothing is stored after you close the page.
Frequently asked questions
What is JSON?
JSON (JavaScript Object Notation) is a plain text format for storing and exchanging data. It is built from objects in curly braces, arrays in square brackets, strings in double quotes, numbers, true, false and null.
Does this tool validate my JSON?
Yes. Click Format or Minify and it tells you whether the text is valid. If not, it shows the line and column of the first error, describes the problem and highlights the character.
Why does it say my JSON is invalid?
The usual reasons are a trailing comma, single quotes instead of double quotes, unquoted property names, or comments. Standard JSON allows none of these.
Why did a large number change after formatting?
JavaScript stores numbers with limited precision, so integers above 9,007,199,254,740,991 and decimals with many digits can be rounded. The tool warns you when this may happen. Store such values as strings to keep them exact.
Does sorting keys change my data?
No. Only the order of keys inside objects changes. Values, array order and nesting stay the same, and keys that look like whole numbers are placed first.
Is my JSON uploaded anywhere?
No. It is processed in your browser and never sent to a server.
Is there a size limit?
There is no fixed limit. Very large files are limited only by your browser and the memory of your device.