Blog

Tutorials, guides, product news and engineering insights from the team that runs your hosting.

Performance and Technical SEO

JSON syntax errors and how to fix them

8 November 2026 1 min read
Share this post

JSON is the most common format applications and APIs use to exchange data. Its rules are simple but strict; one missing quote makes the whole file unreadable.

The most common mistakes

  • Single quotes: strings and keys must use double quotes (").
  • Trailing commas: a comma after the last item is fine in JavaScript but an error in JSON.
  • Comments: // and /* */ are not supported.
  • Unquoted keys: {name: "Ann"} is invalid; it must be {"name": "Ann"}.
  • JavaScript values: undefined, NaN and Infinity are not JSON values.

What “Unexpected token” means

The parser met a character it did not expect at that position. The real mistake is often on the line before; a forgotten comma shows up as an error at the start of the next line.

Large numbers

JavaScript cannot store integers longer than 16 digits exactly. Keeping long IDs such as order or user numbers as strings avoids data loss.

Readability

Pretty-printing one-line JSON makes the structure easy to see; minifying it for production keeps it small.

The JSON formatter and validator shows the line and column of an error and explains the likely cause.

Comments0

No Comments Yet

Be the first to share your thoughts.

Join the Discussion

Please sign in or sign up to leave a comment.

Never Miss a Post

Get our latest tutorials, guides and product news in your inbox.

You're subscribed to our newsletter.