"[object Object]" is not valid JSON
JSON.parse expects a string. When you hand it an object, JavaScript converts that object to a string first, and the default conversion produces the literal text "[object Object]". The parser then fails on the letter o at position 1. The data is fine; the parse call should not be there.
You may also see this written as
- Unexpected token o in JSON at position 1
V8 rewrote most of its JSON error messages in 2022. Older wording is still what most search results show, but no current runtime emits it.
Paste your JSON and see exactly where it breaks
Nothing you paste leaves your browser. The connect-src allowlist makes that a browser guarantee rather than a promise. Check it yourself
What actually causes it
Ranked by how often each one turns out to be the answer.
-
01 The value was already parsed
axios, jQuery.ajax and many API clients parse JSON for you when the Content-Type says so. Parsing the result again is what triggers this.
Breaks
const res = await axios.get('/api/user'); const user = JSON.parse(res.data); // res.data is already an objectWorks
const res = await axios.get('/api/user'); const user = res.data; -
02 An object was stored without being stringified
localStorage and sessionStorage store strings. Passing an object calls String(obj), which writes the literal text "[object Object]". The data is gone at that point, not merely unreadable.
Breaks
localStorage.setItem('user', user); const back = JSON.parse(localStorage.getItem('user'));Works
localStorage.setItem('user', JSON.stringify(user)); const back = JSON.parse(localStorage.getItem('user')); -
03 An object was interpolated into a template string
Building a request body with `{"user": ${user}}` inserts "[object Object]" rather than the object. Build the object and stringify the whole thing instead.
Breaks
body: `{"user": ${user}}`Works
body: JSON.stringify({ user })
Questions
- What happened to "Unexpected token o in JSON at position 1"?
- That was the pre-2022 V8 wording for the same mistake. The o was the second character of the string "[object Object]". The modern message quotes the offending text instead, which is far more useful.
- How do I make this defensive?
- typeof value === "string" ? JSON.parse(value) : value. That is a reasonable guard at a boundary you do not control, though inside your own code it is better to know which one you have.
Fix it now
Paste the payload into the tool above, or go straight to the one built for this job.
Inspect a payload