Skip to main content
Everyday Tools

JSON Formatter & Validator

Paste JSON from an API, a config file or a log and turn it into a readable, indented layout, or shrink it to a single line for use in code. If the JSON has a mistake, the tool tells you the line and column where parsing failed.

Last reviewed:

Your JSON is processed entirely in your browser. It is never uploaded, so it is safe to use with internal or sensitive data.

How to use this calculator

  1. Paste your JSON in the box.
  2. Choose the indentation and, if you want, tick Sort keys.
  3. Click Format to beautify, Minify to compress, or Validate to only check it.
  4. If there is an error, fix the line and column mentioned and try again. Use Copy to copy the result.

Formula and variables

Format = parse the text, then write it back with indentation Minify = parse the text, then write it back with no extra spaces Validate = check that the text parses

  • Valid JSON - double-quoted keys and strings, no trailing commas, no comments, and values that are strings, numbers, true, false, null, arrays or objects.

Worked example

Beautify a compact JSON object.

Inputs and results for the worked example
JSON{"name":"Asha","skills":["Excel","SQL"]}
OutputThe same data on several lines, indented by 2 spaces
  1. The text is parsed into an object.
  2. It is written back with each key on its own line.
  3. Nested arrays are indented one level deeper.

What changes the result

  • Trailing commas. A comma after the last item is the most common reason valid-looking JSON fails.
  • Quotes. Keys and strings need double quotes. Single quotes are not valid JSON.
  • Comments. JSON does not allow comments. Remove them before pasting.
  • Large numbers. Numbers beyond 15–16 digits lose precision when parsed in a browser. Keep such IDs as strings.

Benefits and practical uses

  • Read API responses easily.
  • Find syntax errors by line and column.
  • Safe for sensitive data because nothing is uploaded.

Assumptions and limitations

  • Standard JSON only (RFC 8259). JSON5, comments and trailing commas are rejected.
  • Duplicate keys keep the last value, as in a browser.
  • Very large files may be slow in the browser.

Frequently asked questions

How do I format JSON?

Paste it and click Format. The tool re-writes it with line breaks and indentation.

Why does it say invalid JSON?

There is a syntax mistake such as a missing quote, extra comma or unescaped character. The message shows where the parser stopped.

What does minify do?

It removes all unnecessary spaces and line breaks to make the JSON as short as possible.

Does sorting keys change my data?

Only the order of keys inside objects. Arrays keep their order, and the meaning of the data does not change.

Is my JSON uploaded?

No. Parsing and formatting happen on your device.

Can it fix broken JSON?

No. It points to the problem, and you fix it.

References

Page last reviewed on . This calculator gives estimates for planning only; it is not financial advice and not an offer from any lender.