I saw this question here before (here and here) but still haven't seen any good solution. Since it was asked in 2011 I thought that I might try by myself :)
I need to convert the whole HTML structure into JSON.
Structure:
<body>
<div class="container">
Lorem ipsum dolor
</div>
<h1>This is heading 1
<div class="footer">
tessssst
</div>
</h1>
</body>
Desired JSON:
{
"body": {
"div": {
"text": "Loremipsumdolor",
"class": "container"
},
"h1": {
"div": {
"text": "tessssst",
"class": "footer"
}
}
}
}
Are there any nice methods to do that except for writing my vanilla code? Thanks.