SmartJson.io
← All JSON error messages

"[object Object]" is not valid JSON

By Santhi · Messages captured October 9, 2026 on 11 runtimes · How we test

JavaScript turns any plain object into the 15 characters [object Object] when it needs a string. If that string is then passed to JSON.parse, the parse fails. The data was lost at the moment it became a string, so there is nothing to repair; the fix is in the code that made the string.

What each runtime prints

We ran this input through JSON.parse in each browser and Node version, and through json.loads in Python. These are the messages exactly as printed.

Input: The text [object Object]
[object Object]
RuntimeExact message
Chrome 151Node 24Node 22Node 20"[object Object]" is not valid JSON
Firefox 153JSON.parse: unexpected character at line 1 column 2 of the JSON data
Safari 26 (WebKit)BunJSON Parse error: Unexpected identifier "object"
Node 18Unexpected token o in JSON at position 1
Python 3.13Python 3.12Python 3.10JSONDecodeError: Expecting value: line 1 column 2 (char 1)
  • Chrome and Node 20+ quote the whole text, so the message says exactly what was parsed.
  • Firefox and Python point at column 2. The [ looks like the start of an array, so they fail at the o after it.
  • Node 18 says "Unexpected token o in JSON at position 1", which is the same thing.

Edit it or paste your own. It runs in your browser; nothing is uploaded.

Open the full JSON Repair tool →

Common causes

  1. 1

    localStorage or sessionStorage got an object

    localStorage only stores strings. setItem('user', user) stores the text [object Object], and the JSON.parse when you read it back fails.

  2. 2

    Parsing something that is already parsed

    res.json() and axios response.data already give you an object. JSON.parse(data) converts it back to a string first, and that string is [object Object].

  3. 3

    An object in a template string or concatenation

    `${obj}` and "" + obj both give [object Object]. The same happens when an object is put in a URL, a header, a data- attribute or a form field.

  4. 4

    Sending a request body without stringifying it

    fetch(url, { body: data }) with a plain object sends [object Object]. The server's JSON parser then fails with this error.

How to fix it

Find where the object became a string and use JSON.stringify there.

JavaScript

// Saving
localStorage.setItem('user', JSON.stringify(user));
// Reading (getItem returns null when the key is missing)
const saved = JSON.parse(localStorage.getItem('user') ?? 'null');

// Sending
await fetch(url, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(data),
});

Python

import json

# Python does not make "[object Object]"; it gets it from a JavaScript client.
# Log the raw body to see it:
raw = request.get_data(as_text=True)
print(repr(raw[:200]))
data = json.loads(raw)
  • Before calling JSON.parse, check what you have: typeof value === "string". If it is already an object, use it as it is.

Related

  • Unexpected token '<': your code got an HTML page, not JSON
  • Single quotes in JSON: "Expected property name or '}'"
  • JSON Stringify

How we tested: the messages above come from running each input through the real parsers (Chrome 151, Firefox 153, Safari 26 (WebKit), Node 24, Node 22, Node 20, Node 18, Bun, Python 3.13, Python 3.12, Python 3.10) on October 9, 2026. The script and inputs are listed on How we test.

Published October 9, 2026. Found a message that reads differently in your version? Tell us and we will add it.

All Tools & Converters

JSON Tools

  • JSON Hub
  • JSON Formatter
  • JSON Validator
  • JSON Repair
  • JSON Error Messages
  • JSON Viewer
  • JSON Minify
  • JSON Stringify
  • JSON Sorter
  • JSON Compare
  • JSON to CSV
  • JSON to XML
  • JSON to YAML

XML Tools

  • XML Hub
  • XML Formatter
  • XML Validator
  • XML Compare
  • SOAP Formatter
  • WSDL Formatter
  • XML to JSON
  • XML to CSV

CSV Tools

  • CSV Hub
  • CSV Formatter
  • CSV Validator
  • CSV to JSON
  • CSV to XML
  • Compare Tools

    • JSON Compare
    • XML Compare
    • YAML Compare
    • CSV Compare
    • Text Compare

YAML Tools

  • YAML Hub
  • YAML Formatter
  • YAML Validator
  • YAML to JSON
  • Other Tools

    • Converters Hub
SmartJson.io

JSON, XML, CSV and YAML tools that run in your browser. Nothing you paste is uploaded.

Sitemap

Company

  • About Us
  • Contact
  • How We Test
  • Changelog
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 SmartJson.io. All rights reserved.

Report a problem with this page
Made withfor developers