t▴ToolDock Less busywork. More possibility. ↗
← All guides

How to fix invalid JSON before formatting it

Open JSON Formatter →

A JSON formatter can make valid data readable, but it cannot reliably guess what broken data was supposed to mean. If your API response or configuration snippet fails to format, check the first reported error before changing the rest of the document.

Start with a small, valid example

{
  "product": "ToolDock",
  "enabled": true,
  "tags": ["text", "images"]
}

Open the formatter and choose Try an example. Once that works, paste a copy of your data. Keep the original in your editor so you can compare changes. ToolDock formats with two-space indentation and can also produce a compact version.

Three common syntax problems

For the specific trailing-comma rule, see the MDN syntax reference. A JavaScript object literal and a JSON document are not interchangeable.

Follow the error without deleting useful data

Fix one issue and format again. An error near the end may be caused by a missing quote earlier in the input. A response starting with an HTML tag may be an error page from an API, not JSON at all; inspect the response status before editing it into something else.

Formatting is not schema validation

A document can parse successfully yet be wrong for an API: a required field may be absent or a number may need to be a string. This tool checks syntax, not the rules of your application. It uses JavaScript parsing, so very large integer values can lose precision, and duplicate object keys do not remain separate after parsing. Keep identifiers that must remain exact as quoted strings when your data format permits that. Do not use the output as a lossless archival copy.

Once the result looks right, copy or download it. Tool inputs stay in the browser and are cleared on refresh.

Try JSON Formatter →