Format, check or minify JSON. Runs on your device.
Minifying is for the moment when JSON has to be small or on one line: a config value that goes into an environment variable, a payload you paste into a test request, or a file you want to keep short. This page opens with Minify selected. It removes the spaces, tabs and line breaks between the parts of the JSON and changes nothing else. The sample shows the size of that: formatted with 2 spaces it is 127 B, and minified it is 93 B, with the same keys, values and order. The page shows both sizes in the Size tile after you paste your own text. Be clear about what minifying is not. It is not compression, and it does not hide or protect the data, because anyone can format the text again in one click. Spaces inside a string are part of the value, so they are kept. Numbers and escapes are copied exactly as you wrote them.
The checker follows RFC 8259, the standard definition of JSON. Strings and object keys use double quotes. Comments are not allowed, and neither is a comma after the last item. Any single value can stand alone at the top level, so 42, "hi" and null are valid JSON on their own, and so are objects and lists. The page reports the first problem it finds, with the line and column, and says in plain words what is wrong. It does not repair anything. A text with single quotes, unquoted keys, a trailing comma or a comment is reported as an error, even when JavaScript or a looser format such as JSON5 would accept it. The same goes for a bare word such as undefined or NaN. Only true, false and null can be written without quotes.
An error reads like Invalid JSON at line 3, column 14, followed by a reason. Under it the page shows the line that holds the problem and a caret (^) under the character where the checker stopped. Take a text whose third line is a list ending in 2 and a comma before the closing bracket: the checker stops at that bracket, line 3, column 14. Columns count characters, not bytes, so an emoji counts as one, and a tab counts as one too. The caret line replaces each tab with one space so the caret stays under the right character. A very long line is cut to a window of 80 characters around the problem. Press Show in the text to put the cursor on that character in the box above. The checker stops at the first error, so fix it and the next one, if there is one, appears.
Formatting changes only spaces and line breaks. Every number, string and name is copied exactly as you wrote it, and so are the order of keys and any repeated keys. Many formatters parse the text and print it again, which rewrites the data: 12345678901234567890 would come out as 12345678901234567000, and 1.0 as 1, because JavaScript numbers cannot hold every digit. This page does not parse the numbers at all, so 12345678901234567890, 1.0 and 1E3 stay as they are, and an escape such as \u00e9 is not turned into the letter. Minify does the opposite of Format: it removes every space and line break between the parts, and nothing else. The data is the same before and after. It does not compress the text, it does not hide it, and it does not sort keys or remove repeated ones.
You can paste or type up to 2,097,152 characters, or load one UTF-8 text file of up to 2 MB. The file does not need to end in .json; it is judged by its content. Indented output is built only when it would be 10,000,000 characters or fewer. A deeply nested text can be small and still become huge when indented, because every level adds spaces to every line below it. When that happens the page says so and suggests Minify or Check only. The box shows the first 100,000 characters of a long output, and Copy and Download give all of it. Nothing is uploaded and the text is not stored: close the tab and it is gone. The page counts visits with Google Analytics, using only the name of the tool and the fact that a result appeared, and no text is in those counts.
It depends on how much indentation the text has. The sample goes from 127 B formatted with 2 spaces to 93 B minified. A text that is already on one line does not change. The Size tile shows the before and after sizes for your own text.
Yes. Only the spaces, tabs and line breaks between the parts are removed. Spaces inside a string are kept, and numbers such as 1.0 or 12345678901234567890 are not rewritten. Reading it back gives the same keys, values and order.
Yes. Choose Format and pick 2 spaces, 4 spaces or a tab. Because the page only changes spaces and line breaks, formatting a minified text gives the same layout as formatting the original.
JSON is a stricter format than JavaScript. A comma after the last item, as in [1,2,], is valid in a JavaScript list but not in JSON, so most programs that read JSON reject it. The checker reports it as an error at the closing bracket and tells you to remove the comma.
No. A number is copied as written, so 12345678901234567890 stays 12345678901234567890 and 1.0 stays 1.0. A formatter that parses and prints the data would show 12345678901234567000 and 1, because it has to turn the digits into a JavaScript number first.
No. Keys stay in the order you wrote them, and a repeated key such as {"a":1,"a":2} keeps both members. The text counts as valid, and the Keys tile counts the repeated name twice.
No. A // or /* comment is reported as an error at the line and column where it starts, and so are single quotes and unquoted keys. Remove the comment or convert the file to plain JSON first. The page never edits your text for you.
You can paste up to 2,097,152 characters or load a file of up to 2 MB. Indented output over 10,000,000 characters is not built, which can happen with a deeply nested list of 1,000 levels. Minify and Check only still work then.
No. The text is read and checked in this tab. It is not sent anywhere, put in the page address or stored; the only things the page remembers are the Output and Indent choices. A file you load is read on your device and its name is not shown or kept.