About this tool
A one-line blob of JSON is hard to read and harder to debug. Responses from APIs, lines from logs and values from environment variables all tend to arrive without whitespace.
DataFmt's JSON Formatter uses the browser's native parser to pretty-print JSON with proper indentation. You can optionally sort object keys recursively, which is handy for creating stable snapshots that are friendly to version-control diffs.
How to use
- Paste JSON into the input panel or upload a .json file.
- Pick an indent width (2 spaces, 4 spaces or Tab).
- Optionally enable "Sort keys" for stable ordering.
- Click "Format" and copy or download the output.
Use cases
- Inspect compressed API responses and discover the shape of the data at a glance.
- Normalise hand-written JSON configs across a repository for a uniform team style.
- Generate sorted JSON snapshots that produce clean diffs during code review.
Notes
- Strict JSON syntax only — no comments or trailing commas (use a JSONC parser if you need those).
- Invalid JSON is reported with a line and column number to help you fix it quickly.
- Sorting only affects object keys; array element order is preserved.
Frequently Asked Questions
Is the output fully equivalent to the input?
Yes — only whitespace and (optionally) key ordering change. Values, types and structure are preserved.
Do you support JSON5 or JSONC?
Only strict JSON in this release. Clean comments and trailing commas before pasting, or use a JSONC-aware parser.
Is my data uploaded anywhere?
No. Formatting happens entirely in the browser with no network requests.
How large a document can it handle?
Tens of megabytes are typically fine. For files above that, reach for jq or a Node.js script.