how can i get json data by using javascript in to un order list. i tried a lot and trying to get help from google but i couldn't find any solution. i am new with json and javascript.
i want to get json data like that image
let assetsdata=[];
function getAssets(){
for ( let assets in assetsdata ){
//console.log(assetsdata[assets]);
let userID = assetsdata[assets].userId;
let list2 = assetsdata[assets].dataList;
for (let key in list2) {
let list3 = list2[key];
document.getElementById('demo').innerHTML += "<li>"+ key + '<ul id="listTwo"></ul></li>' ;
for (let key2 in list3) {
document.getElementById('listTwo').innerHTML += " <li> "+ list3[key2] + "</li>";
}
}
};
}
fetch('js/getJson.json').then(function(resp){
return resp.json();
})
.then(function(data){
assetsdata = data.assetsData;
getAssets();
});
here is my json data
{
"assetsData": [
{
"userId": 1,
"description": "Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De Finibus Bonorum et Malorum for use in a type specimen book.",
"dataList": {
"GUIDELINES" :
[
"Guidlines 1",
"Guidlines 2",
"Guidlines 3",
"Guidlines 4"
]
}
},
{
"userId": 2,
"description": "Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De Finibus Bonorum et Malorum for use in a type specimen book.",
"dataList": {
"AFTER-SALES" :
[
"NISMO",
"down" , {
"Market" : [
"DIGITAL",
"OpH",
"Pos",
"print",
"social gif",
"social videos"
]
}
]
}
}
]
}
`
– Barmar Dec 12 '19 at 06:23