title: Convert a selected HTML Table to JSON
body: <p>Is it possible to convert just a selection of a HTML with multiple tables to JSON ?</p>
  
  <p>I have this Table:</p>
  
  <pre><code>&lt;div class="mon_title"&gt;2.11.2015 Montag&lt;/div&gt;
      &lt;table class="info" &gt;
      &lt;tr class="info"&gt;&lt;th class="info" align="center" colspan="2"&gt;Nachrichten zum Tag&lt;/th&gt;&lt;/tr&gt;
      &lt;tr class='info'&gt;&lt;td class='info' colspan="2"&gt;&lt;b&gt;&lt;u&gt;&lt;/u&gt;   &lt;/b&gt;
      ...
      &lt;/table&gt;
      &lt;p&gt;
      &lt;table class="mon_list" &gt;
  
      ...
      &lt;/table&gt;
  </code></pre>
  
  <p>And this PHP code to covert it into JSON:</p>
  
  <pre><code>function save_table_to_json ( $in_file, $out_file ) {
      $html = file_get_contents( $in_file );
      file_put_contents( $out_file, convert_table_to_json( $html ) );
  }
  
  function convert_table_to_json ( $html ) {
      $document = new DOMDocument();
      $document-&gt;loadHTML( $html );
  
      $obj = [];
      $jsonObj = [];
      $th = $document-&gt;getElementsByTagName('th');
      $td = $document-&gt;getElementsByTagName('td');
      $thNum = $th-&gt;length;
      $arrLength = $td-&gt;length;
      $rowIx = 0;
  
      for ( $i = 0 ; $i &lt; $arrLength ; $i++){
          $head = $th-&gt;item( $i%$thNum )-&gt;textContent;
          $content = $td-&gt;item( $i )-&gt;textContent;
          $obj[ $head ] = $content;
          if( ($i+1) % $thNum === 0){ 
              $jsonObj[++$rowIx] = $obj;
              $obj = [];
          }
      }
      save_table_to_json( 'heute_S.htm', 'heute_S.json' );
  </code></pre>
  
  <p>What it does is takes the table <code>class=info</code> and the table <code>class=mon_list</code> and converts it to json. </p>
  
  <p>Is there any way that it can just take the table <code>class=mon_list</code>?</p>