How to format, sort, and minify JSON for different workflows
Choose indentation for review, optional key sorting for a diff, or compact output for a tool that expects one line.
Open JSON FormatterFormatting changes how JSON is displayed, which makes different kinds of review easier. Choose a readable format for a teammate, a stable representation for a comparison, or compact output when the destination expects one line. Save the original before converting, especially if exact numeric precision or signing matters.
Format the copy you need to read
Open JSON Formatter and choose the indentation your project uses. Try the same two objects with two spaces and four spaces. Two spaces can fit more nesting on a narrow screen. Four spaces may match an existing file. Neither setting changes what the fields mean.
If the formatter reports a syntax error, check the characters immediately before the indicated position. Our JSON debugging guide shows common cases. If the source is a JSON-like configuration with comments, confirm the file type before making it strict JSON.
Sort keys when it helps the review
Optional key sorting can make two objects easier to compare when they contain the same keys in different orders. Leave array order intact if it represents a sequence. For example, the items in an approval workflow should remain in the order they are performed, even if you sort the keys within each item.
Use Text Compare after formatting both copies with the same settings. Check that the differences now reflect changes in values rather than whitespace. Some applications care about the exact bytes, especially when a signature or checksum is computed from the original text.
Minify only the delivery copy
Use Minify for a compact export. This can remove formatting whitespace but does not replace checking the destination schema. Keep the readable file in your project if people need to maintain it. JSON parsed by ordinary JavaScript can normalize numbers or lose precision for very large integer values. Preserve those as strings only where the consumer expects strings, or use a precision-aware workflow.
For a comparison of a browser formatter, a project editor, and a command-line tool, see Best JSON formatters and validators.
Ready to try it?
JSON Formatter is free to use and runs in your browser.
Try JSON Formatter