[object Object] is not a valid JSON usually means your code passed the string representation of a JavaScript object to JSON.parse(). That text is not JSON. Check the value’s type and how it was stored: use an object directly, or serialize a plain object with JSON.stringify() before saving it as text.
What the error means
JSON.parse() expects a string containing valid JSON text. It turns that text into the value it represents; it does not convert an existing JavaScript object into JSON. MDN documents the method and examples of invalid JSON, including single-quoted strings and trailing commas: MDN: JSON.parse().
A plain object commonly becomes the string [object Object] when JavaScript coerces it to text. That string is not JSON, so parsing it fails. The same mismatch can happen when an object is passed straight to JSON.parse() or written directly to Web Storage, which stores strings rather than preserving an object’s structure.
Check the value immediately before parsing
Inspect the exact value and its runtime type where the error occurs:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
console.log(sbs, typeof sbs);
If this value may contain password-reset details or other sensitive data, do not expose it in shared or production logs. Use a safe local debugging environment and avoid logging secrets.
- If the value is already an object, use it directly; do not parse it.
- If it is a string, inspect its contents. It may be
[object Object]or malformed JSON for another reason. - If it came from Web Storage, check the code that wrote it as well as the code that reads it.
Choose the fix that matches the value
The value is already a JavaScript object
Access its properties directly. For example:
const data = { user: { email: "[email protected]" } };
const email = data.user.email;
Calling JSON.parse(data) is incorrect because data is already an object, not JSON text.
Rank #2
You need to store and restore a plain object
Serialize the object before writing it to Web Storage, then parse the retrieved string:
const sessionData = { user: { email: "[email protected]" } };
sessionStorage.setItem("sbsession", JSON.stringify(sessionData));
const sbs = sessionStorage.getItem("sbsession");
const restoredSession = sbs === null ? null : JSON.parse(sbs);
JSON.stringify() converts a JavaScript value into JSON text. MDN documents the method and the Web Storage string behavior, including what happens when a plain object is stored directly: MDN: JSON.stringify() and MDN: Storage.setItem().
This is an appropriate round trip for the plain object shown. JSON does not preserve every JavaScript type, and circular references cause serialization to throw, so do not assume every JavaScript value can be safely serialized this way.
The retrieved value is a string, but parsing still fails
Examine the raw string and check its JSON syntax. A value can be a string without being valid JSON: for example, JSON requires double-quoted strings, and a trailing comma can make an otherwise familiar-looking object invalid. The specific error text may differ depending on the engine and malformed input.
Rank #4
How this relates to the SitePoint password-reset thread
In a SitePoint Community thread dated November 11–12, 2023, the poster pointed to sessionData = JSON.parse(sbs), where sbs came from sessionStorage.sbsession. A reply suggested the stored value might have been written as an object without serialization, leaving the text [object Object]. The poster later reported fixing their app by retrieving the user email directly with getItem(): SitePoint Community thread.
That reported fix applies to that app’s flow; it does not mean every similar error should be fixed by bypassing parsing. If the email is stored separately and you need only that value, retrieve the corresponding key directly. If you need to restore the full session object, verify the key and stored value shape, then serialize the object when writing it.
Recommended Free Tools
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




