JSON.parse expects a string. When you pass it an object, JavaScript coerces the input with toString(), and every plain object stringifies to "[object Object]". The parser reads the opening bracket at position 0 without complaint, then hits the o at position 1 and gives up. The error message is telling you exactly what the input was. Once you see that, the fix is clear: stop parsing.
I see this one most often in fetch code, and it always comes from the same misunderstanding. Somewhere in the chain, the JSON already got parsed, and then somebody parses it again for safety. The second parse is the bug. There is no malformed JSON anywhere. The payload was fine.
How to fix JSON.parse unexpected token o in JSON at position 1
The fix depends on where the first parse happened. Work through the three usual suspects in order.
1. Double parsing after fetch
The fetch API parses for you when you call res.json(). If you then pass the result to JSON.parse, you get this exact error.
const res = await fetch("/api/user");
const data = await res.json();
const parsed = JSON.parse(data); // SyntaxError: Unexpected token o
const res = await fetch("/api/user");
const data = await res.json();
// data is already an object. Use it directly.
The same trap hides in Axios. Axios parses the response body into response.data automatically. Parsing response.data again fails the same way. If a helper function or a wrapper already returns an object, every parse after that is one too many.
2. A library that already parsed it
WebSocket handlers, message queues, and test helpers sometimes hand you an object while the docs describe a string. The code that worked against one version of a library breaks when the next version starts parsing for you. When this error appears after a dependency upgrade, check the changelog for exactly that change before you touch your own code.
The diagnostic is one line. Log the type before you parse:
console.log(typeof value); // "object" means skip JSON.parse console.log(String(value).slice(0, 100)); // shows "[object Object]" if coerced
If the type is object, use the value directly. If the type is string, print the first hundred characters. A string that starts with [object Object] was already damaged upstream, and no amount of parsing will repair it.
3. The localStorage version, where the bug happened earlier
This one is sneakier, because the error shows up at read time while the bug happened at write time. localStorage stores strings only. If you save an object without stringifying it, localStorage stores the literal text "[object Object]". Later, when you read it back and parse it, you get the position 1 error, and the real data is long gone.
localStorage.setItem("prefs", prefs); // stores "[object Object]"
localStorage.setItem("prefs", JSON.stringify(prefs));
const prefs = JSON.parse(localStorage.getItem("prefs"));
When you find this version, the fix has two halves. Stringify on write from now on, and accept that whatever was stored before the fix is unrecoverable. That second half stings, but there is nothing to recover. The original object was never saved.
The safe parse pattern
When a function genuinely might receive either a string or an object, guard on the type instead of parsing blindly:
function parseMaybe(input) {
if (typeof input !== "string") return input;
return JSON.parse(input);
}
Keep the try/catch around the parse if the string comes from outside your code, like a network response or user input. A malformed string should fail loudly at the boundary, not silently return the raw text and break three functions later.
What this error is not
It is not a trailing comma, a missing quote, or a malformed payload. A JSON repair tool will not help here, because there is nothing to repair. The input was never JSON text. If your input looks like a JSON string but the error mentions a different letter, the diagnosis changes: an "Unexpected token u" means the input was the word undefined, and an "Unexpected token <" means the server sent an HTML error page instead of JSON. Each letter names the real problem, if you read it as a clue rather than noise.
Paste your broken JSON and get valid JSON back instantly, with a plain-English list of every fix.
Fix My JSON NowFrequently asked questions
What does "Unexpected token o in JSON at position 1" mean?
You passed an object to JSON.parse. JavaScript coerced it to the string "[object Object]", and the parser failed on the o at position 1.
Why does JSON.parse turn my object into [object Object]?
JSON.parse expects a string, so JavaScript calls toString() on non-string input. A plain object stringifies to "[object Object]".
How do I check whether my value is already parsed?
Check typeof value. If it is object, the value is already parsed, so skip JSON.parse. If it is string, parsing is correct.
I stored an object in localStorage and now it fails. What happened?
You stored the object without JSON.stringify, so localStorage saved the literal string "[object Object]". Always stringify when writing and parse when reading.
Related reading: Unexpected Token 'u' in JSON at Position 0: You Parsed the Word "undefined" · "Unexpected End of JSON Input": Empty Body, Cut-Off Payload, or Unclosed Bracket · Why Is My JSON Invalid? The 7 Syntax Errors That Break JSON.parse