How to pass value to js object on the html page?

I'm in the js file, get array of object which I need to pass on the html page but don't know how, please tell me how this can be done.
Here is the object that I have
0: {
building: ""
category: "Walls"
family: "Basic Wall"
level: ""
revitid: "281899"
room: ""
symbol: "Wall-Ext_102Bwk-75Ins-100LBlk-12P"
viewid: 3300
}
1: {
building: ""
category: "Walls"
family: "Basic Wall"
level: ""
revitid: "282264"
room: ""
symbol: "Wall-Ext_102Bwk-75Ins-250LBlk-12P 2"
viewid: 3304
}


And that's the place where you want to send.
<div id="differencesDiv"></div>

As a result, I should obtain such a list in this container:
    • Model
      • Walls
        • Basic Wall
          • Wall-Ext_102Bwk-75Ins-100LBlk-12P
            • Basic Wall [281899]




    • Model
      • Walls
        • Basic Wall
          • Wall-Ext_102Bwk-75Ins-250LBlk-12P 2
            • Basic Wall [282264]






Very hope for your help.
March 19th 20 at 08:57
1 answer
March 19th 20 at 08:59
Solution
This array, according to keys, you can use forEach
But if this object (the keys not serial)
let data = {...};
let html = ";
for (let k in data) {
 if (!data.hasOwnProperty(k)) continue;
 let item = data[k];
 html += '<ul>';
 html += '<li>'+item['category']+'</li>';
 html += '<li>'+item['symbol']+'</li>';
 // ...
 html += '</ul>';
}
document.getElementById('differencesDiv').innerHTML = html;
You understand correctly, I forgot to say, it's an array. - constance.Auer commented on March 19th 20 at 09:02
Thank you a good programmer. - constance.Auer commented on March 19th 20 at 09:05

Find more questions by tags HTMLJavaScript