Display JSON data in HTML Table.

244 views
Skip to first unread message

suriab

unread,
Mar 23, 2018, 12:02:48 PM3/23/18
to Node-RED
I am new to Node-Red. I have following JSON data which changes at run time i.e. more objects[] are added/removed every 5 seconds. I need to display it in HTML table output. JSON data comes correctly from exec every 5 seconds however parsing and displaying in HTML is something I am not getting it work especially with nested array in JSON.

Example Run#1 

JSON:

{ "Line:" : [{ "LineID" : "1","Sensors": [{ "Counter":"1", "ID" : "134552", "Value" : "22.375"}] },{ "LineID" : "2","Sensors": [{ "Counter":"1", "ID" : "78654", "Value" : "22.812"},{ "Counter":"2", "ID" : "7655544", "Value" : "22.12"}] },{ "LineID" : "4","Sensors": [{ "Counter":"1", "ID" : "11223", "Value" : "12.793"},{ "Counter":"2", "ID" : "1234552", "Value" : "122.187"},{ "Counter":"3", "ID" : "124551", "Value" : "-9.750"}] }]}


Example Run#2
JSON
{ "Line:" : [{ "LineID" : "1","Sensors": [{ "Counter":"1", "ID" : "134552", "Value" : "22.375"}] },{ "LineID" : "2","Sensors": [{ "Counter":"1", "ID" : "78654", "Value" : "22.812"},{ "Counter":"2", "ID" : "7655544", "Value" : "22.12"}] },{ "LineID" : "4","Sensors": [{ "Counter":"1", "ID" : "11223", "Value" : "12.793"},{ "Counter":"2", "ID" : "1234552", "Value" : "122.187"},{ "Counter":"3", "ID" : "124551", "Value" : "-9.750"}] },
{ "LineID": "5", "Sensors": [{ "Counter": "1", "ID": "3ebc1ff", "Value": "1222.187" }] }]}


Thanks in advance.

steve rickus

unread,
Mar 23, 2018, 12:10:52 PM3/23/18
to Node-RED
Lots of examples in this mailing list -- have you tried searching for "html table"?
Here is an example that I posted several weeks ago... since your data is nested, you will have to modify the paths to the fields to be shown, but it should give you some ideas.

suriab

unread,
Mar 24, 2018, 6:56:08 PM3/24/18
to Node-RED
Thanks I will try it.
Reply all
Reply to author
Forward
0 new messages