# How to show Json object in a notification popup, pretty-printed

**URL:** https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111
**Category:** Dashboard
**Tags:** dashboard-2
**Created:** [17 May 2025 22:02 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111 "2025-05-17T22:02:10Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [17 May 2025 22:02 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/1 "2025-05-17T22:02:10Z")

</div>

I can pretty print an object to the debug panel:

```auto
const myObject = {
  name: 'Eleanor',
  age: 30,
  hobbies: ['Chocolate', 'Swimming', 'Ornithology']
};

const prettyPrintedObject = JSON.stringify(myObject, null, 2);
msg.payload = (prettyPrintedObject);
return msg;

```

This is the output

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7fbb4f39fd5382b0f936c9ea1188d8f21b38e6c3.png)

But passing that string to a dashboard notify node recombines all the lines:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e76247778566c68b0fd096368c7a6c814d049915.png)

How can I get a similar pretty print in a dashboard notification?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 May 2025 22:33 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/2 "2025-05-17T22:33:54Z")

</div>

Not really D2 but should be usable anyway. I have a web component that will do this.

> **[Testing TotallyInformation's web-components - syntax-highlight](https://wc.totallyinformation.net/tests/syntax-highlight)**

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 May 2025 23:02 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/3 "2025-05-17T23:02:44Z")

</div>

since the notification supports html, just wrap your string in a `<pre>`

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [18 May 2025 05:51 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/4 "2025-05-18T05:51:50Z")

</div>

Thanks both. 😄

The `<pre>` tags do what I need.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/4736db2ecf606ce9912b4a567b2e2e0c3e13c544.png)

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [18 May 2025 09:46 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/5 "2025-05-18T09:46:47Z")

</div>

> [@jbudd](#):
>
> The `<pre>` tags do what I need.

Oops, I spoke too soon.

It does indeed work for the above json snippet (ie it satisfies the title of the thread).

But with real world data it causes the notification popup to extend below the bottom of the screen; no scrollbar is shown.

Without a scrollbar there is no way to get to the "Close" button to click it.  
This looks like a bug in the notification node?

Further, `ctrl a` **also** selects everything in the dashboard beneath the popup.  
This also looks like a bug in the notification node?

What I'm actually trying to do is display the json that defines a change node so the user can copy it and import into their editor. There are several "Set .... to" lines each containing json, so the pretty output from JSON.stringify() is not really ideal.

I've had a look at the Markdown node too but I can't seem to get the code to both display and be importable.

Edit - What I am trying to achieve is analgous to the editor's "Export a selected node in compact format" function, only with the node settings generated in the dashboard.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [18 May 2025 09:56 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/6 "2025-05-18T09:56:29Z")

</div>

can you add some local CSS to make the scrollbars auto ?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [18 May 2025 10:00 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/7 "2025-05-18T10:00:26Z")

</div>

> [@jbudd](#):
>
> But with real world data it causes the notification popup to extend below the bottom of the screen; no scrollbar is shown.

That can be solved by adding styles or utility classes to the pre - or wrap it in a div.

something like:

```html
      <v-sheet
        class="overflow-y-auto"
        max-height="300"
      >
        <pre style="white-space: pre-wrap; word-wrap: break-word; padding: 2px;">JSON_HERE</pre>
      </v-sheet>

```

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [18 May 2025 10:07 UTC](https://discourse.nodered.org/t/how-to-show-json-object-in-a-notification-popup-pretty-printed/97111/8 "2025-05-18T10:07:26Z")

</div>

Good suggestion @dceejay. I can right click in the popup and Inspect to see it's makeup.

I can add

```auto
v-overlay__content {
overflow: scroll;
}

```

Which does create a scrollbar but it's slider is also off the bottom of the screen.  
So I can scroll down and then select all the code, but only using the keyboard up/down keys.
