# Debug node shows object object

**URL:** <https://discourse.nodered.org/t/debug-node-shows-object-object/2458>\
**Category:** General\
**Created:** [22 August 2018 02:36 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458 "2018-08-22T02:36:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ncherry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncherry/32/27_2.png) [@ncherry](https://discourse.nodered.org/u/ncherry)\
**Post date:** [22 August 2018 02:36 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458/1 "2018-08-22T02:36:31Z")

</div>

Hmm, I can't find the debug message where this occurred but htere are times when I set up the debug node to show a complete msg and the debug window shows an unexpandable object object. Has anyone one else run into this?

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [22 August 2018 04:25 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458/2 "2018-08-22T04:25:28Z")

</div>

Sounds like you are seeing the string "[Object Object]" (which is why it's not expandable). Somewhere along the flow, an incoming object was converted to a string -- here are a couple of ways that could happen in the Javascript language:

```auto
> var test = {};
undefined
> test
{}
> test.toString()
'[object Object]'
> "" + test
'[object Object]'

```

---

<div class="post-metadata">

**Author:** ![ncherry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncherry/32/27_2.png) [@ncherry](https://discourse.nodered.org/u/ncherry)\
**Post date:** [22 August 2018 04:52 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458/3 "2018-08-22T04:52:39Z")

</div>

Thanks, that's helpful! I'll keep that in mind when I see it next time and see if I can fix that. I may have fixed it this time and not realized that is what I did.

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [5 January 2023 18:29 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458/4 "2023-01-05T18:29:22Z")

</div>

Picking up on this thread:  
How can I avoid the **[object Object]** display in the debug widow?

When I define & assign an object literally, it expands correctly in the debug pane:

```auto
msg.payload = {a:"aaa",b:5};

```

Shows as  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/60d73acdf502a40529b2895baa2442eddd337379.png)

However, if I construct the object dynamically, e.g.:

```auto
function tmpObj() {
    this.a = "aaa";
    this.b = 5;
}
msg.payload = new tmpObj();

```

It shows  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8bb3ab6d4de07616d76958aecdbcbd367b703081.png)

Note that when I change the debug node display to "complete msg object", the object unfolds correctly:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/7/17816335f7d4eeb2365d3146b3c4291eff03294d.png)

Any clue, anyone?

---

<div class="post-metadata">

**Author:** ![kevinGodell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kevingodell/32/27040_2.png) [@kevinGodell](https://discourse.nodered.org/u/kevinGodell)\
**Post date:** [5 January 2023 18:32 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458/5 "2023-01-05T18:32:14Z")

</div>

Json stringify could be an option

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [5 January 2023 18:43 UTC](https://discourse.nodered.org/t/debug-node-shows-object-object/2458/6 "2023-01-05T18:43:41Z")

</div>

Wow, thanks for the quick answer!  
Doing JSON stringify and then parse does solve the issue.  
Thanks!

Though I wonder what is the root cause of this, and whether I can avoid this workaround, since the object can be very large, and this will be replicating it twice
