About the JSON Formatter
The JSON Formatter makes JSON readable and checks that it is valid. Paste a compact response from an API and get a neatly indented version, or minify a formatted file to reduce its size.
If the input is not valid JSON, the tool shows the parser's error message so you can find the problem. Frequent causes are trailing commas, single quotes instead of double quotes, and unquoted property names.
How to use it
- Paste JSON into Input JSON.
- Press Format for indented output or Minify for one compact line.
- Copy the result from the output box.
Fixing common errors
Keys and strings must use double quotes: {"a":1}.
No comma is allowed after the last item in an object or array.
Comments are not part of JSON and cause errors.
Real-world examples
Reading an API response. Paste a compact one-line response and read it with indentation.
Finding a typo. A missing comma or quote shows up as an error message with a position.
Shrinking a config. Minify before embedding JSON into a page.
Common mistakes
Trailing commas, single quotes and unquoted keys are valid in JavaScript but not in JSON. Comments are not allowed. Copying from a web page can bring in curly quotes, which are different characters from straight quotes. Large numbers beyond 15 to 16 digits may lose precision when parsed.
How it works
The text is parsed with the browser's strict JSON parser, which fails on any syntax error and reports where. If it succeeds, the resulting structure is written back out with two-space indentation (Format) or with no whitespace at all (Minify). Key order is preserved.
Frequently asked questions
Does it change my data?
No, only whitespace changes.
Is it uploaded?
No, parsing is done in your browser.
Can it handle big files?
Several megabytes are usually fine.