By Vivek - October 6, 2026

Find and Fix Common JSON Syntax Errors

A JSON syntax error prevents a formatter, query or comparison from reading the document. Fixing the first reported error is usually more useful than changing several things at once: a missing comma can make the parser complain about the next property even though that property’s spelling is correct.

Open the JSON Formatter and Validator, paste your document into JSON input, and click Validate. It shows the browser’s parser message and, when that message supplies a location, the line and column. Error wording varies between browsers; the MDN JSON parsing error reference explains common cases.

Fix a trailing comma

This document is invalid because the final property has a comma after it:

{
  "id": 101,
  "name": "Ada",
}

Remove the comma after "Ada", then validate again:

{
  "id": 101,
  "name": "Ada"
}

The corrected document should pass validation. Click Format JSON to produce readable indentation. The same rule applies to arrays: [1, 2,] must become [1, 2].

Separate properties and quote their names

These are three separate mistakes with different repairs:

{"id": 101 "active": true}
{'id': 101, 'active': true}
{id: 101, active: true}

The first needs a comma between the properties. The second needs double quotes in place of single quotes. The third needs double quotes around property names. All three can be corrected to:

{"id": 101, "active": true}

JavaScript object notation is not always valid JSON. JSON also does not accept comments, undefined, NaN or Infinity. Do not replace an unsupported value with null unless that replacement matches the intended data contract.

Escape characters inside a string

A quote inside a string must be escaped. This valid example preserves the quotation marks around a word:

{"message": "Ada said \"hello\""}

An actual line break inside a quoted string is invalid. Use the JSON escape \n when the value should contain a newline:

{"message": "First line\nSecond line"}

A literal backslash also needs escaping. For example, {"folder":"C:\\temp"} represents a value containing one backslash. Avoid replacing every quote or backslash globally: that can damage characters that were already escaped correctly.

Check whether the response is really JSON

An error mentioning < near the start can mean the server returned HTML, such as a sign-in page or an error page. Check the HTTP status, response body and content type in your request tool. Changing an HTML response’s punctuation will not turn it into the API data you expected.

A document ending halfway through a string or object may be truncated. Retrieve the full response rather than adding closing brackets by guesswork. An empty body is not a JSON document; a request may legitimately return no content, depending on its status and API contract.

What a successful validation establishes

Validation here establishes that the text parses as JSON. It does not check required API fields, valid email addresses or allowed status values. After syntax is fixed, generate a starting JSON Schema if you need to describe the response’s shape.

Use the JSONPath extraction guide when the corrected response is large, or compare records by ID when investigating a change. The JSON tools hub connects these steps.