How to use the JSON Formatter
- 1Paste your JSON.
- 2Choose indentation or minify.
- 3Copy or download the formatted JSON.
About the JSON Formatter
Raw API responses are hard to read. The JSON formatter pretty-prints data with your preferred indentation, sorts keys and minifies for production.
Invalid JSON is reported with the exact line and column of the error.
When to use the JSON Formatter
Reading a compressed API response
An API response delivered on a single line makes nested fields difficult to trace. Paste the response and choose two spaces, four spaces, or tabs to expose its structure. The expanded output helps you follow arrays and objects while investigating an unexpected value, and you can copy or download the result.
Reducing noisy configuration review differences
Two configuration snapshots may contain similar data but use inconsistent indentation or object key ordering. Format both with the same indentation and enable Sort keys to make visual review easier. Sorting applies within nested objects too, while array item order remains unchanged, helping you distinguish layout differences from changes to data.
Preparing compact JSON for a fixture
A small test fixture or example request sometimes needs compact JSON rather than an expanded document. Use Minify to remove formatting whitespace after parsing the input. Review the resulting values before saving the output, especially if the source includes very large integers that JavaScript cannot represent exactly as ordinary numbers.
Tips and best practices
- Choose indentation to match the repository receiving the file. Two spaces, four spaces, and tabs are available; consistent formatting makes later reviews easier to follow.
- Keep an untouched source copy before formatting data with large numeric identifiers. JSON parsing can round integers outside JavaScript's safe integer range, changing their written values.
- Do not use the formatted output to verify an existing digital signature over raw JSON text. Parsing and serialization can change whitespace, escaping, and numeric representations.
- Resolve syntax errors in the input rather than expecting automatic repair. Missing commas, unquoted property names, comments, and trailing commas prevent the formatter from producing output.