I am trying web scraping for the first time. I am able to get the html table which is defined like:
Please note: There are empty tr elements between the tbody. And first tag in tr is th.
<table> <tbody> <tr></tr> <tr> <th>1 abc</th> <td>good</td> <td><a href="/good">John (Nick)</a></td> <td>Lincoln</td> </tr> <tr> <th>20 xyz</th> <td>bad</td> <td><a href="/bad">Emma</a></td> <td>Smith</td> </tr> <tr></tr> ... </tbody> </table>I have omitted thead for ease. I just want them to json like:
{ "collections": [ { "size": "1", # from 1 abc "identity": "abc", # from 1 abc "name": "John (Nick)" # from <a href="/good">John (Nick)</a> }, ... ] }I have followed [this](https://stackoverflow.com/questions/1854...le-to-json). But I'm having trouble to out json like in the given example.
Please note: There are empty tr elements between the tbody. And first tag in tr is th.