JSON Formatter and Validator
Paste JSON and get it indented, minified, or with its keys sorted. When it is broken you get a line number, a column and the offending line printed with a marker underneath — not a character offset.
JSON Formatter and Validator
Valid JSON · object with 2 keys · 38 bytes larger
{
"name": "Kavitha",
"tools": [
{
"slug": "json-formatter",
"free": true
}
]
}How to use it
- Paste your JSON into the input box.
- Choose format, minify, or sort keys. Formatting re-serialises the parsed value, so the output is always canonical.
- If it fails to parse, read the line and column reported and look at the marked line below it.
- Use sort keys before diffing two API responses — it removes false differences caused by key order.
- Copy the result with the button rather than selecting it by hand.
Frequently asked questions
- Why does my JSON fail with a trailing comma?
- The JSON specification forbids it, even though JavaScript allows it in object and array literals. It is the single most common cause of a parse failure — remove the comma before the closing brace.
- Can I use comments in JSON?
- Not in standard JSON. Some parsers accept a superset called JSON5 or JSONC, but anything strictly conforming, including this page, will reject them.
- Why did my long ID number change?
- JSON numbers are parsed as double-precision floats, which cannot represent every integer above roughly nine quadrillion exactly. Send large identifiers as strings if they need to survive a round trip.
Related tools
- Base64 Encoder and DecoderEncode and decode Base64 in your browser, including URL-safe Base64. Handles emoji, Sinhala and Chinese, which btoa-based tools cannot.
- CSV to JSON ConverterConvert CSV to JSON and back in your browser, with correct handling of quoted fields, embedded commas and newlines inside cells. Nothing uploads.
- Text Diff CheckerCompare two texts and see exactly which lines were added, removed or kept, aligned properly rather than line by line. Runs in your browser.
Built and maintained by Kavitha Kanchana
Software engineer at Cortana AI and co-founder of Ryzera Technologies, based in Sri Lanka. Found a bug or a wrong number? Email me.