About JSON Formatter
A JSON formatter turns a one-line API response or a cramped config file into something a person can read. Paste the JSON and it's pretty-printed right away with 2 spaces, 4 spaces or tabs, or squeezed into a single line with Minify when you need it small for a request or an environment variable.
If the JSON is broken, you see Invalid JSON with the position of the problem, given as line and column in Chrome, Edge and Firefox. It usually points at a missing comma, an extra comma or an unclosed quote. Sort keys puts object keys in alphabetical order, handy before comparing two files. The check is strict, so comments and single quotes count as errors. Save the result as data.json. To compare two JSON files, format both with Sort keys and paste them into Text Compare.
How to use JSON Formatter
- 1Paste your JSON
Paste into Input, drop a .json file on the box, or click Open file.
- 2Pick the format
Choose 2 spaces, 4 spaces, Tab or Minify, and tick Sort keys if you want.
- 3Fix any errors
If the JSON formatter reports Invalid JSON, go to the line and column shown and correct it.
- 4Copy or save
Copy the result or save it as data.json.
Why use Cubfile for this
- Beautify or minify
Indent with 2 or 4 spaces or tabs, or strip all whitespace.
- Error position shown
The first syntax error is located for you, so you don't hunt through the whole file.
- Sort keys
Alphabetical keys at every level make two JSON files easy to compare.
- Stays in your browser
API keys and customer data in your JSON are never uploaded.