 <p>Here is an answer using <a href="http://jsoup.org/download" rel="nofollow">Jsoup</a> and <a href="http://mvnrepository.com/artifact/org.json/json/20140107" rel="nofollow">JSON</a> as dependencies: </p> <pre><code>final String HTML = "&lt;table cellspacing=\"0\" style=\"height: 24px;\"&gt;\r\n&lt;tr class=\"tr-hover\"&gt;\r\n&lt;th rowspan=\"15\" scope=\"row\"&gt;Network&lt;/th&gt;\r\n&lt;td class=\"ttl\"&gt;&lt;a href=\"network-bands.php3\"&gt;Technology&lt;/a&gt;&lt;/td&gt;\r\n&lt;td class=\"nfo\"&gt;&lt;a href=\"#\" class=\"link-network-detail collapse\"&gt;GSM&lt;/a&gt;&lt;/td&gt;\r\n&lt;/tr&gt;\r\n&lt;tr class=\"tr-toggle\"&gt;\r\n&lt;td class=\"ttl\"&gt;&lt;a href=\"network-bands.php3\"&gt;2G bands&lt;/a&gt;&lt;/td&gt;\r\n&lt;td class=\"nfo\"&gt;GSM 900 / 1800 - SIM 1 &amp; SIM 2&lt;/td&gt;\r\n&lt;/tr&gt; \r\n&lt;tr class=\"tr-toggle\"&gt;\r\n&lt;td class=\"ttl\"&gt;&lt;a href=\"glossary.php3?term=gprs\"&gt;GPRS&lt;/a&gt;&lt;/td&gt;\r\n&lt;td class=\"nfo\"&gt;Class 12&lt;/td&gt;\r\n&lt;/tr&gt; \r\n&lt;tr class=\"tr-toggle\"&gt;\r\n&lt;td class=\"ttl\"&gt;&lt;a href=\"glossary.php3?term=edge\"&gt;EDGE&lt;/a&gt;&lt;/td&gt;\r\n&lt;td class=\"nfo\"&gt;Yes&lt;/td&gt;\r\n&lt;/tr&gt;\r\n&lt;/table&gt;"; Document document = Jsoup.parse(HTML); Element table = document.select("table").first(); String arrayName = table.select("th").first().text(); JSONObject jsonObj = new JSONObject(); JSONArray jsonArr = new JSONArray(); Elements ttls = table.getElementsByClass("ttl"); Elements nfos = table.getElementsByClass("nfo"); JSONObject jo = new JSONObject(); for (int i = 0, l = ttls.size(); i &lt; l; i++) { String key = ttls.get(i).text(); String value = nfos.get(i).text(); jo.put(key, value); } jsonArr.put(jo); jsonObj.put(arrayName, jsonArr); System.out.println(jsonObj.toString()); </code></pre> <p>Output (formatted):</p> <pre><code>{ "Network": [ { "2G bands": "GSM 900 / 1800 - SIM 1 &amp; SIM 2", "Technology": "GSM", "GPRS": "Class 12", "EDGE": "Yes" } ] } </code></pre>