JSON formatter and validator
Paste JSON to format it, minify it or check it. If something is wrong you see the line, the column and the likely fix. Long numbers keep every digit. Nothing is uploaded: it all runs in this page.
Recommended. Without it, numbers go through JavaScript and long ones get rounded (12345678901234567890 becomes 12345678901234567000).
Choose Format, Minify or Validate.
Escape or unescape a string
Turn text into something safe to put inside a JSON string (quotes, line breaks and backslashes become \" \n \\), or turn it back.
How it works
- •The page reads your JSON with its own strict parser that follows the JSON standard (RFC 8259). It is stricter than JavaScript: no trailing commas, no comments, no single quotes, no NaN or undefined.
- •When something is wrong it reports where the text stopped making sense. That is often the character right after the real mistake, so look at the marked spot and the item just before it. Columns count characters, and lines are split at line feeds.
- •Formatting never goes through JavaScript numbers by default. A value such as 12345678901234567890 is copied digit for digit, whereas JSON.parse followed by JSON.stringify would turn it into 12345678901234567000. Numbers that JavaScript could not hold exactly are listed so you know which ones to send as strings.
- •If the same key appears twice in an object, both are kept and you get a warning, because most programs silently keep only the last one.
- •The limits are 5 MB of text and 500 levels of nesting. Sorting keys orders them by character code, so uppercase letters come before lowercase.
Questions
- Is my JSON uploaded?
- No. The text is processed by code running in this page and is never sent anywhere. Copy and download also happen on your device.
- Why did another formatter change my big number?
- Most tools read numbers as JavaScript doubles, which are exact only up to 9,007,199,254,740,991 (2^53 - 1). Anything longer gets rounded. This page keeps the original digits and warns you, but programs that read the JSON with JavaScript will still round it, so send IDs that long as strings.
- Why is my JSON rejected when it works in my JavaScript code?
- JavaScript object literals allow trailing commas, comments, single quotes and bare keys. JSON allows none of them. The hint under the error says which one it looks like.
- Does valid mean the data is correct?
- No. It means the text follows the JSON grammar. It does not check that the right keys exist or that values have the right type. For that you need a schema validator.