How to format JSON
- Paste your JSON into the box — an API response, a configuration file or a log entry.
- Press Format to pretty-print it with two-space indentation, or Minify to remove all unnecessary whitespace.
- If the JSON is invalid, the error message from your browser’s parser tells you what went wrong and usually where. Fix it and try again.
- Press Copy to copy the result.
Common JSON errors
- Trailing commas such as
{"a": 1,}are not allowed in JSON. - Single quotes: strings and keys must use double quotes,
"name", not'name'. - Unquoted keys like
{name: "Ann"}are valid JavaScript but not valid JSON. - Comments (
//or/* */) are not part of standard JSON. - Special values such as
undefined,NaNorInfinityare not allowed.
Why a local formatter matters
JSON often contains things that should never be pasted into a random website: API keys, access tokens, customer records, internal URLs. Many online formatters send your input to a server. This one uses the JSON parser built into your browser, so the data never leaves your computer.
Frequently asked questions
Why did a large number change after formatting?
JavaScript stores numbers as 64-bit floating-point values, so integers larger than 9,007,199,254,740,991 (for example some database IDs) lose precision when parsed. Store such IDs as strings in JSON.
What happens with duplicate keys?
If an object contains the same key twice, only the last value is kept in the formatted output.
Is the key order preserved?
Yes, keys keep their original order, except that keys which look like whole numbers are placed first, as defined by JavaScript.