How to Format JSON and Fix Common Syntax Errors

Updated 8 October 2026

Use JSON Formatter to make valid JSON easier to inspect, check whether it parses or remove whitespace. This implementation parses with JavaScript JSON.parse and writes formatted output with JSON.stringify. It does not apply JSON Schema validation.

Choose the right action

  1. Paste a small JSON sample first: {"name":"Auvatrix","active":true}.
  2. Select Format for two-space indentation.
  3. Select Minify for compact JSON without optional whitespace.
  4. Select Validate to check parsing without using formatting as a substitute for a schema check.

Fix invalid JSON

Property names and string values need double quotes. Comments, single-quoted strings and trailing commas are not accepted. Boolean values use true or false without quotes; null is also unquoted.

Invalid: {"active":true,}
Valid:   {"active":true}

A parsing error indicates invalid syntax. Correct the source and rerun. Browser error messages may vary, so treat the message as a starting point rather than relying on one exact wording.

Protect large integer identifiers

JavaScript numbers cannot represent every large integer exactly. Parsing a precision-sensitive numeric identifier can change its value before formatting. Where the data contract allows it, represent such identifiers as strings, for example {"id":"9007199254740993"}. Formatting is not a lossless transformer for all possible numeric values.

Formatting is not data validation

A document can be syntactically valid while containing incorrect field names, missing required properties or values of the wrong type for your API. Validate those requirements separately against your API contract or JSON Schema.

What should I check before copying?

  • Verify required fields and values against the original data.
  • Check large numeric identifiers and duplicate property names; parsing can discard information.
  • Use non-sensitive sample data when testing a public tool.
  • Minification changes presentation, not the intended meaning of the parsed JSON.

Tools used in this guide