So the last few days i have been struggling to find a working solution to this problem.(NodeJS)
I already tried things like cheerio html tables etc but most of them dont work cause they dont handle the rowspans etc.
Basically i need a HTML table like this :
<table class="k" border-width="3">
<tbody>
    <tr>
        <th width="50">
            XXXXXX </th>
        <th width="50">
            YYYY</th>
        <th width="50">
            </th>
        <th width="50">
            ZZZZZZZZ</th>
        <th width="50">
            QQQQ</th>
        <th width="50">
            LLLL</th>
        <th width="150">
        </th>
    </tr>
    <tr class="k">
        <td rowspan="11" class="k">
            11</td>
        <td>
            Data</td>
        <td>
            1</td>
        <td>
            Data2</td>
        <td>
        </td>
        <td>
            Data3</td>
        <td>
            Data4</td>
    </tr>
    <tr>
        <td>
           Data5</td>
        <td>
            2</td>
        <td>
             </td>
        <td>
            Data6</td>
        <td>
             </td>
        <td>
             Data7</td>
    </tr>
    <tr>
        <td>
             Data8</td>
        <td>
            2</td>
        <td>
             </td>
        <td>
        </td>
        <td>
             </td>
        <td>
             Data10</td>
    </tr>
    <tr>
        <td>
             Foo</td>
        <td>
            3</td>
        <td>
             Foo</td>
        <td>
        </td>
        <td>
             Foo</td>
        <td>
             Foo</td>
    </tr>
    <tr>
        <td>
             Foo</td>
        <td>
            3</td>
        <td>
             Foo</td>
        <td>
        </td>
        <td>
             Foo</td>
        <td>
             </td>
    </tr>
    <tr>
        <td>
             Foo</td>
        <td>
            4</td>
        <td>
             Foo</td>
        <td>
        </td>
        <td>
             Foo</td>
        <td>
             </td>
    </tr>
    <tr>
        <td>
             Foo</td>
        <td>
            4</td>
        <td>
             </td>
        <td>
        </td>
        <td>
             </td>
        <td>
             Foo</td>
    </tr>
</tbody>
to convert to something like this:
{
"XXXXXX": "11",
"YYYY": "Data",
"SSS": "1",
"ZZZZZZZZ": "Data2",
"QQQQ": "",
"LLLL": "Data3",
"Data4": ""}
for each row in the table
via Denis B.
No comments:
Post a Comment