JSFiddle - React, Tailwind, and code Playground
HTML
<table class="content">
<tbody>
<tr>
<th>head1</th>
<td>value1</td>
</tr>
<tr>
<th>head2</th>
<td>value2</td>
</tr>
</tbody>
</table>
<table class="content">
<tbody>
<tr>
<th>alpha1</th>
<td>value4</td>
</tr>
<tr>
<th>alpha2</th>
<td>value5</td>
</tr>
<tr>
<th>alpha3</th>
<td>value6</td>
</tr>
</tbody>
</table>
JavaScript
function createJSON(){
var self = this;
self.thejson = {};
$('.content tr').each(function(index, value){
var k = $('th', this).text(), v = $('td', this).text();
self.thejson[k] = v;
});
return self.thejson;
}
console.log(createJSON());