🧩JSON Formatter

Pretty-print and format JSON

How to use the JSON formatter

JSON copied out of an API response or a log line usually arrives as one long string, which makes it hard to see where each object begins. Paste it here and the tool parses it and prints it back with indentation. Choose two spaces, four spaces or a tab, or pick minify from the same menu to collapse everything onto a single line again.

If the syntax is wrong you get the parser message exactly as the browser reports it instead of a result. That message includes the position where parsing failed, which is usually enough to spot a missing quote or a stray trailing comma. Input is accepted up to 200,000 characters.

Turn on key sorting and object keys are rearranged alphabetically, including objects nested inside other objects and objects inside arrays. Array order itself carries meaning, so it is never changed. Because a standard JSON parser is used, JSON5 style comments are reported as errors, duplicate keys collapse to the last value, and integers beyond 2^53 may lose precision. Everything runs locally in your browser.

Frequently asked questions

Can it format JSON that contains comments?

No. A standard JSON parser is used, so comments and trailing commas are reported as syntax errors. Remove them and paste the text again.

Does key sorting reach nested objects?

Yes. Objects inside objects and objects inside arrays are all sorted alphabetically. The order of array elements is left alone because it is meaningful.