JSON formatter
Turn a one-line API response into readable, indented JSON. Choose the indent, optionally sort keys, and get the exact error position if it doesn’t parse.
Turn a one-line API response into readable, indented JSON. Choose the indent, optionally sort keys, and get the exact error position if it doesn’t parse.
Formatted JSON is easier to read, but a table is easier still for non-developers. Send the same data through JSON to table, JSON to Excel or JSON to YAML.
It parses the JSON and prints it again with consistent indentation and one property per line, so nested structures are easy to read and diff. The data itself does not change.
It is a style choice. Two spaces is the default in JavaScript tooling (Prettier, npm’s package.json); four spaces is common in Python (json.dumps(indent=4)). Pick whatever your project’s formatter uses so diffs stay clean.
JSON objects are unordered, so two equal documents can list keys in a different order. Sorting keys alphabetically makes them identical text, which is useful before comparing two API responses or committing fixtures.
Numbers are parsed as JavaScript doubles, so integers above 9,007,199,254,740,991 (2^53 − 1) lose precision, and 1.0 is printed as 1. If you have 64-bit IDs, keep them as strings in your JSON.