JSON Formatter & Minifier
Format, validate, and minify JSON data.
Formats JSON into readable, indented text or minifies it onto one line, and tells you straight away whether it is valid. Formatting runs in your browser, so API responses, config files and tokens you paste stay on your device.
Options
- Format — Pretty (indented, one value per line) or Minified (no spaces or line breaks).
- Indent size — 1 to 8 spaces per level; 2 by default.
- Sort object keys — orders keys alphabetically at every level; arrays keep their order.
- Compact arrays — keeps arrays that hold no objects on one line, handy for lists of numbers or coordinates.
When the JSON is invalid, the output names the problem with its line and column, and the line is highlighted in the input. Common mistakes — trailing commas, single quotes, unquoted keys and comments, all allowed in JavaScript but not in JSON — are named as such.
What formatting keeps
The JSON is read and written out again with its data as written: numbers keep every digit, so IDs beyond 9,007,199,254,740,991 are not rounded as JavaScript would round them, and 1.0 stays 1.0. Keys keep their order unless you sort them.
When a key appears twice in the same object, only the last value is kept, in the first one's place.
Examples
Large numbers and repeated keys
- Input
- { "id": 12345678901234567890, "price": 1.0, "10": "x", "price": 2.50 }
- Minified
- {"id":12345678901234567890,"price":2.50,"10":"x"}
The ID keeps every digit, "10" stays after price, and the repeated price keeps its last value.
See also
- JSON Schema Validator — to check the JSON against a schema, not just its syntax.
- JSON to CSV Converter — to turn a JSON array into a spreadsheet.