How to format and check JSON
- Paste your JSON into Your JSON, or press Open a file to load a .json or text file. You can also drag a file onto the box. Try an example fills it for you.
- The tool checks the text as you type. If it is valid, you see Valid JSON and the formatted result on the right, with a count of the objects, lists and keys inside it.
- If something is wrong, the box on the right shows the lines around the mistake with a marker under the exact spot, and the message says what is wrong and how to fix it in plain words.
- Choose how to see the result, then press Copy result or Download .json. Use result as my text moves the result back into the left box so you can keep editing it.
Formatted, minified and tree views
- Formatted puts every key and list item on its own line, indented to show how the data is nested. Choose two spaces, four spaces or a tab to match the style of your project.
- Minified removes every space and line break so the JSON sits on one line. It means the same thing but is smaller, which helps when you send it to a server or store it in a limited space. The count under the box shows how many characters it saves.
- Tree shows objects and lists as folders you can open and close, which makes it easier to explore a large response from an API. The first two levels open for you; open the rest as you need them.
- Sort keys A to Z puts the keys of every object in alphabetical order. This is useful before comparing two JSON files, because the same data written in a different key order then looks identical. Lists keep their order, since the order of a list can carry meaning.
The most common JSON mistakes
JSON is stricter than the JavaScript it was borrowed from. These are the mistakes people make most often, and the tool names each one with its line and column:
- A trailing comma, as in
{"a": 1,}or[1, 2,]. JSON does not allow a comma after the last item. Remove it. - Single quotes, as in
{'a': 'b'}. JSON only accepts double quotes around text and keys. - Keys without quotes, as in
{a: 1}. Every key must be text in double quotes. - Comments, such as
// noteor/* note */. JSON has no comments; remove them, or keep the note in a value such as"_note": "…". - A missing comma between two items, such as
{"a": 1 "b": 2}. - Brackets that do not match, such as a list closed with
}, or an object left open at the end of the text. - Values that JavaScript has but JSON does not:
undefined,NaNandInfinity. Usenullor a plain number. AlsoTrueandFalsemust be written in lowercase. - Numbers written in other ways:
07(a leading zero),.5and5.(a missing digit) and+1are all invalid. Write7,0.5,5.0and1. - Raw line breaks inside text. A line break or tab inside a string must be written as
\nor\t, and a backslash as\\.
Fix and format
When the mistakes are of the easy kind (comments, trailing commas, single quotes or unquoted keys), a Fix and format button appears next to the message. It repairs your text, formats it and tells you what it changed. This is handy for JavaScript objects copied out of code, or configuration files with comments. It will not guess at anything ambiguous: a missing comma, a missing bracket or an undefined value still has to be fixed by you, and for those Go to the mistake jumps your cursor to the right spot in the left box.
Numbers and text are kept exactly
Many online formatters read your JSON into a program and write it back out, and that round trip can quietly change the data. JavaScript, for example, cannot store the whole number 12345678901234567890 exactly and rounds it, and it writes 1.0 as 1. If those numbers are order IDs or timestamps, the change is a real problem. This formatter keeps every number and every piece of text character for character as you wrote it, and only changes the spacing, plus the order of keys if you choose to sort them. Duplicate keys are kept as well, with a warning, instead of silently dropping one.
JSON is not the same as a JavaScript object
JSON looks like the object syntax of JavaScript, but it is a stricter data format that nearly every language can read. A JavaScript object can have unquoted keys, single-quoted text, comments, trailing commas and values such as undefined; JSON can have none of these. A value in JSON is one of: an object in curly braces, a list in square brackets, text in double quotes, a number, true, false or null. Dates have no special form in JSON; they are usually written as text, such as "2026-10-22".
Tips
- Validate before you send. A single stray comma makes a whole request or configuration file fail. Paste it here first to see the exact line.
- Compare two JSON files by formatting both with the same indentation and with Sort keys turned on, then paste the results into the text compare tool. Only real changes will show.
- Use the tree for unfamiliar data. Opening a large API response as a tree shows its shape faster than scrolling through formatted text.
- Keep secrets out of shared screenshots. The tool does not upload your JSON, but anything you paste can still end up in a screenshot or screen share.
Other text tools: tidy capitals with the case converter, count characters with the character counter, or keep notes in the online notepad.
Your JSON stays on your device
JSON often holds private data, so everything happens in your browser: the checking, formatting, minifying and tree view all run on your own computer or phone, and nothing is sent to this website or anyone else. The page remembers your latest text and settings in your browser on this device so they survive a reload. Clear removes the text, and clearing the site’s data in your browser removes everything.
Frequently asked questions
Is my JSON uploaded to a server?
No. The checking and formatting run in your browser, so nothing you paste or open is sent anywhere. That makes it safe for JSON that contains private data such as customer records or API keys. The page keeps your last text on this device so it is still there after a reload; press Clear to remove it.
What does “Fix and format” repair?
It repairs the mistakes that are easy to get right: comments, a trailing comma before a closing bracket, single quotes around text, and keys without quotes, as often found in JavaScript objects. It cannot guess missing brackets, a missing comma between values, or values such as undefined and NaN, so for those the tool shows you the line and column and you fix them yourself.
Does formatting change my numbers?
No. Numbers and strings are copied exactly as you wrote them. Many tools read the JSON into a program first and write it back, which can round a long number such as 12345678901234567890 or turn 1.0 into 1. This formatter only changes the spacing and the order of keys if you ask for sorting.
What is the difference between formatted and minified JSON?
Both mean the same thing to a program. Formatted JSON has line breaks and indentation so people can read it. Minified JSON removes every space and line break to make the file smaller, which is useful when sending it over a network or storing it in a limited space.
Why does it say a key appears more than once?
JSON allows the same key twice in an object, but the result is unreliable: most programs keep only the last value and silently ignore the earlier ones. The tool keeps both in the output so nothing is lost, and warns you so you can decide which one is right.
How big a file can it handle?
A file you open can be up to 5 MB, and pasting works for similar sizes. A few megabytes of JSON formats in a fraction of a second on a normal computer. The tree view shows the first 500 items of each list or object to keep the page quick; the Formatted and Minified views show everything.