Anatomy of the error message
Every variant of the error carries up to three clues: the token (the exact character the parser rejected), the position (a zero-based index into the string you passed to JSON.parse), and, in newer engines, a line and column. The wording depends on the JavaScript engine, not on your code. Modern V8 — Chrome, Edge, Node 20+ — quotes the token with a context snippet, which is what the validator above shows for the preloaded sample. Older V8 said "Unexpected token a in JSON at position 24". Firefox reports "at line 1 column 25 of the JSON data", and Safari names the identifier it stumbled over. Same failure, four spellings — never string-match on error text.
Two things trip people up. First, the position is where the parser gave up, not always where the bug lives: a quote that was never closed turns everything after it into one long string, so the failure gets reported far downstream of the real mistake. When the position looks nonsensical, scan backwards for an unbalanced quote. Second, the position indexes the exact string your code received — including every space and newline — not a pretty-printed copy of it.
Parsers also stop at the first illegal character, so a document with several mistakes reports exactly one error. The sample on this page demonstrates it: fix the unquoted admin and a second error appears at the missing comma. Fix, re-validate, repeat — the loop takes seconds in the validator above.