# \[ANNOUNCE\] node-red-contrib-jsontohtml

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279>\
**Category:** Share Your Nodes\
**Created:** [9 December 2020 23:07 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279 "2020-12-09T23:07:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [9 December 2020 23:07 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/1 "2020-12-09T23:07:49Z")

</div>

Hi folks,

I was re-installing one of my Raspberry devices, and I found some custom nodes on it that were about 95% finished. I have such nodes lying around all over the place. It it is a very bad habbit. I should reserve some time to finalize the last 5% instead of starting with something new ...

Anyway I have quickly published one of those nodes on NPM ( 🍾 🥂):

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

This [node-red-contrib-jsontohtml](https://github.com/bartbutenaers/node-red-contrib-jsontohtml) node allows you transform a Javascript object to HTML, based on a specified transformation.

On the readme page you can find an example, where I inject an object (containing the statusses of various sensors):

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

Which is then transformed to HTML.  
This allows me to show a popup dialog in my Node-RED dashboard very easily:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1377e21458ee69b40a7ff3b547ba299c7ec3e73.png)

Have fun with it!!  
Bart

---

<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:** [9 December 2020 23:47 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/2 "2020-12-09T23:47:22Z")

</div>

Errr why wouldn't I just use a template node ?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [10 December 2020 06:22 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/3 "2020-12-10T06:22:30Z")

</div>

> [@dceejay](#):
>
> Errr

That sounds not like a motivational contribution speech...

Do you mean to write the html manually in a template node? Or is there perhaps a standard way to convert json to html, which I'm not aware of?

---

<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:** [10 December 2020 09:06 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/4 "2020-12-10T09:06:22Z")

</div>

Yes - that is exactly what the template node has been doing for the last 6 years...

```auto
[{"id":"21d27fe8.709f9","type":"inject","z":"ab9333b5.f44f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"name\":\"Front door\",\"status\":\"OPEN\"},{\"name\":\"Kitchen door\",\"status\":\"CLOSED\"},{\"name\":\"Bathroom window\",\"status\":\"CLOSED\"}]","payloadType":"json","x":100,"y":2080,"wires":[["2a4f2827.5def58"]]},{"id":"2a4f2827.5def58","type":"template","z":"ab9333b5.f44f6","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Notifications: \n{{#payload}}\n<li>{{name}} - <b>{{status}}</b></li>\n{{/payload}}","output":"str","x":260,"y":2080,"wires":[["97a3b8b1.c7c538","8dcd2d7f.40e3e"]]},{"id":"97a3b8b1.c7c538","type":"debug","z":"ab9333b5.f44f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":2120,"wires":[]},{"id":"8dcd2d7f.40e3e","type":"ui_toast","z":"ab9333b5.f44f6","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":true,"topic":"","name":"","x":450,"y":2080,"wires":[[]]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/50976331eac348e985e10199386b58892b984ed6.png)

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

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [10 December 2020 14:42 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/5 "2020-12-10T14:42:28Z")

</div>

OMG...  
Never seen this kind of functionality before ...  
I will put your example on my readme page, and explain that is the standard way to go...  
Thanks for the example!

---

<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:** [10 December 2020 16:39 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/6 "2020-12-10T16:39:32Z")

</div>

🙂 .... w do warn folk to discuss things here before diving in and writing loads of code... ah well as long as you enjoyed yourself.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [10 December 2020 19:00 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/7 "2020-12-10T19:00:33Z")

</div>

This must be one of my first custom nodes. Have used it since I started with Node-RED, and never have seen something similar passing by in the discussions that I follow. So it hasn't come up my mind that there was anything to discuss about it ...

Anyway I have updated the readme:

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

And added your example:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/39d295d4a1600f2d719cafd95297402fb8d00731.png)

It now looks more like a advertising brochure for the Template node 😉

---

<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:** [10 December 2020 19:23 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/8 "2020-12-10T19:23:40Z")

</div>

:-). Stick to SVG goodness.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 February 2021 23:07 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-jsontohtml/37279/9 "2021-02-07T23:07:51Z")

</div>

This topic was automatically closed after 60 days. New replies are no longer allowed.
