---
title: "Discussion on \"Why your JSON won't parse: the 6 usual suspects (and how to format it safely in the browser)\" | Hashnode"
description: "Discussion on \"Why your JSON won't parse: the 6 usual suspects (and how to format it safely in the browser)\". Unexpected token } in JSON at position 214 is one of the most common errors a developer sees, and it is almost always one of a handful of mistakes. JSON looks like JavaScript, but it is much stricter."
url: "https://hashnode.com/posts/why-your-json-won-t-parse-the-6-usual-suspects-and-how-to-format-it-safely-in-the-browser/6ad31da7cca0bdd79faf9450"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why your JSON won't parse: the 6 usual suspects (and how to format it safely in the browser)](https://gotoolsonline.hashnode.dev/why-your-json-won-t-parse-the-6-usual-suspects-and-how-to-format-it-safely-in-the-browser?utm_source=hashnode&utm_medium=feed)

Unexpected token } in JSON at position 214 is one of the most common errors a developer sees, and it is almost always one of a handful of mistakes. JSON looks like JavaScript, but it is much stricter.

Oct 17 · 3 min read · gotoolsonline.hashnode.dev  
Read the article

-   [#json](https://hashnode.com/tag/json)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#beginners](https://hashnode.com/tag/beginners)

## Written by

[GoToolsOnline](https://hashnode.com/@gotoolsonline)

@gotoolsonline

  
[View profile](https://hashnode.com/@gotoolsonline)

Free online tools for developers: JSON, text, image and more. No sign-up.

I run GoToolsOnline (gotoolsonline.com), a free collection of browser tools for developers and students. No sign-up.

## Responses 3

Markdown supported · ⌘↵ to post

[StackShortlist](https://hashnode.com/@veristria)

[Oct 17](https://hashnode.com/posts/why-your-json-won-t-parse-the-6-usual-suspects-and-how-to-format-it-safely-in-the-browser/6ad31da7cca0bdd79faf9450/comment/6ad32b76756f94d8163919a9)

The point about the error position is the one that saves the most time. The parser points at where it gave up, so a missing comma on the line above shows up as an error on the next key. Worth adding: JSON.parse also chokes on a BOM at the start of a file read from disk, and the error for that is fairly cryptic.

[GoToolsOnline](https://hashnode.com/@gotoolsonline)

[Oct 17](https://hashnode.com/posts/why-your-json-won-t-parse-the-6-usual-suspects-and-how-to-format-it-safely-in-the-browser/6ad31da7cca0bdd79faf9450/comment/6ad32b76756f94d8163919a9#reply-6ad3924d9606e364a9fbc62f)

Thanks, that's exactly it. The parser reports where it gave up, not where the mistake is, so the line just above is usually the culprit. Great point on the BOM too. It's invisible in most editors and the error message gives no hint, so stripping it first (or re-saving as UTF-8 without BOM) saves a lot of head-scratching. I'll add it to the post.

[StackShortlist](https://hashnode.com/@veristria)

[Oct 18](https://hashnode.com/posts/why-your-json-won-t-parse-the-6-usual-suspects-and-how-to-format-it-safely-in-the-browser/6ad31da7cca0bdd79faf9450/comment/6ad32b76756f94d8163919a9#reply-6ad477b5589eef5c4a05ffe6)

Good call adding it. A one-line check that strips a leading BOM before parsing would make a nice small snippet next to it, since that is the fix people will want to copy.
