Toolza guides / developer

How to Format JSON and Fix Common Syntax Errors

Paste JSON into the formatter and choose Format. If parsing fails, correct the reported syntax issue and try again. Formatting makes valid JSON readable; it does not repair an invalid document automatically.

Use the interactive tool ↓

Start with a valid document

JSON property names and string values use double quotes. Separate properties with commas, balance braces and brackets, and use lowercase true, false, and null. JSON does not permit JavaScript comments, single-quoted strings, or trailing commas.

JSON · example
{"name":"Toolza","enabled":true,"tags":["pdf","images"]}

Choose Format to expand that document with indentation. Choose Minify to remove unnecessary formatting whitespace. Neither operation changes string values intentionally.

Format and inspect the result

Try it here

JSON Formatter & Validator

Processed on your device. Your files never leave your browser.
Open the standalone JSON Formatter & Validator tool →

This is the existing formatter, using JSON.parse and JSON.stringify in your browser. The formatting operation does not upload pasted JSON. Do not paste credentials or private production payloads into an unfamiliar environment; the examples here contain no secrets.

Fix common syntax errors

Replace single quotes

The following text is invalid JSON:

TEXT · example
{'name': 'Toolza'}

Use double quotes for both the key and string value:

JSON · example
{"name": "Toolza"}

Remove a trailing comma

This object is invalid because the final property ends with a comma:

TEXT · example
{"enabled": true,}

Correct it to:

JSON · example
{"enabled": true}

Escape characters inside a string

A quoted word inside a JSON string needs escaped quotes. This valid document preserves the quotation marks in its value:

JSON · example
{"message": "Choose \"Format\" to continue", "path": "C:\\reports"}

The error location is a starting point. A missing quote or bracket can make a parser notice the problem later than the actual mistake. Work outward from the reported position and check the preceding value.

Protect numeric identifiers

JavaScript numbers cannot represent every integer exactly. The formatter can change a large numeric identifier after parsing. Store identifiers as strings when their exact digits matter:

JSON · example
{"accountId": "9007199254740993"}

Do not use this utility as a lossless editor for arbitrary-precision numbers. Duplicate object keys are another risk: parsing can retain only the last value. For example, parsing {"x":1,"x":2} and formatting it produces a single x property with value 2.

Copy, download, and compare

  1. Select an indentation option, then choose Format.
  2. Inspect the output and any important identifiers.
  3. Copy the output or download the .json file.
  4. If the result is going into an application, validate it against that application’s expected schema separately.

Valid JSON can still contain the wrong fields or values. This tool checks JSON syntax; it does not validate an API contract. Use Text Diff for a readable comparison, while remembering that insignificant whitespace changes may produce many differences.

Technical references

The behavior follows JSON.parse and JSON.stringify. Read their limitations before processing numeric data or relying on a parse/stringify round trip to preserve an original document byte for byte.