{
"subjectId": 1,
"subjectName": "Physics",
"topics": [
{
"id": 1,
"name": "Thermodynamics",
"children": null
},
{
"id": 51,
"name": "Random Variables",
"children": [
{
"id": 52,
"name": "Discrete random variable",
"children": [
{
"id": 53,
"name": "Probability mass function",
"children": null
}
]
}
]
}
]
}
Please help me how to display the names from the above json data in below format through javascript and the json was generating dynamically and I want to run the loop until the children length equals to null.
<ul>
<li>Physics
<ul>
<li>thermodynamics</li>
</ul>
</li>
</ul>