JSON formatter
Web & developerHow can you format and check JSON?
Paste JSON to find errors, tidy it up or make it compact.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
Not saved in the link or anywhere else.
JSON validation
Valid JSON
Copy the full output or download it as a JSON file.
JSON output
{
"b": 2,
"a": [
1,
true,
null
]
} Source: up to 20,000 characters. Formatting: up to 32 nesting levels. JSON stays in this tab and never enters a link.
Duplicate keys keep the last value. Numbers use standard floating-point precision; out-of-range numbers and unsafe integers are not formatted.
Sponsored Links
Paste JSON to find errors, tidy it up or make it compact.
How to use
- Paste your JSON. The result immediately shows whether it is valid or where the first error occurs.
- Choose pretty print or minify. For pretty print, choose two spaces, four spaces or tabs. Optionally sort object keys.
- Copy the output or download a .json file. Long previews are shortened, but copies and downloads contain the full output.
Valid JSON values after minifying
| Input | Minified |
|---|---|
| [1, 2, 3] | [1,2,3] |
| [true, false] | [true,false] |
| [null, 0] | [null,0] |
| ["a", "b"] | ["a","b"] |
| [[], []] | [[],[]] |
Sponsored Links
How it works
JSON represents objects, arrays, strings, numbers, true, false and null. Object names and strings use double quotes. A trailing comma or a comment is not part of JSON. This checker follows the JSON grammar in RFC 8259 and reports the first error with a line and column, both counted from one.
Pretty printing adds line breaks and indentation; minifying removes unnecessary whitespace. For example, [1, 2] becomes [1,2] when minified. Spaces inside a string remain part of its value. Sorting rearranges object keys recursively while keeping array order; keys that are integer indices appear first in numeric order.
The tool accepts up to 20,000 source characters and formats up to 32 nesting levels. Duplicate names keep the last value. Decimal numbers may round to standard floating-point precision, while numbers outside the supported range and unsafe integers are refused for output. Text stays in the browser and is never put in a link.
Frequently asked questions
Why is my JSON invalid?
Common causes are single quotes, unquoted names, comments and trailing commas. The reported position is where the problem was detected; a missing quote or bracket may be earlier.
Does formatting preserve every character?
No. Whitespace, escapes and number notation may change. Duplicate keys keep only the last value, and decimal precision is limited. Use quoted strings for identifiers or exact decimal amounts that must not change.
Why does valid JSON sometimes produce no output?
Validation checks syntax separately from formatting limits. Deeply nested data, non-finite parsed numbers and integers outside the safe range can be syntactically valid but are not formatted.
Can a JSON document be just a number or a string?
Yes. A JSON value can be an object, array, string, number, true, false or null.
Does sorting keys also sort arrays?
No. Sorting changes object keys recursively; array elements keep their order.
Next you might need
- Text diffSee additions and removals, line by line or word by word., private, runs on your deviceText toolsChecker
- UUID generatorRandom UUIDs, version 4 or time-ordered version 7, made on your device., private, runs on your deviceWeb & developerGeneratorEncoding
- Data size converterConvert between bytes, kilobytes, megabytes, gigabytes, MiB, GiB and bits, with 1,000 and 1,024 kept apart., private, runs on your deviceUnit conversionConverterEncoding
- Base64 encode and decodeEncode text or a file to Base64 and decode it back, right in your browser., private, runs on your deviceText toolsConverterEncoding
- Braille translatorTurn text into Unified English Braille cells and back: letters, capitals, numbers and basic punctuation., private, runs on your deviceText toolsConverterEncoding
- QR and Barcode ScannerScan with your camera or an image and see what a code holds, and where a link really leads, before you open it., private, runs on your deviceMedia and filesCheckerEncoding
More in Web & developer
All 18 utilities in Web & developer- Password generatorA random password made on your device, with its strength in bits and nothing sent anywhere., private, runs on your device
- Browser infoBrowser, engine and device facts, reported here., private, runs on your device
- Color contrast checkerCheck the WCAG contrast of text on a background, see which levels it passes, and get a nearby color that does., private, runs on your device
- Color converterPick or type any color and copy it as HEX, RGB, HSL, HWB or OKLCH, with its nearest CSS name., private, runs on your device
- DNS lookupLook up addresses, mail servers and other DNS records.
- Download time calculatorEnter the file size and your connection speed to see how long a download or upload takes., private, runs on your device
Popular now
Sponsored Links
Sponsored Links
Sponsored Links