 <p>Try this code</p> <pre><code>var trArray = []; $('#tbPermission tr').each(function () { var tr =$(this).text(); //get current tr's text var tdArray = []; $(this).find('td').each(function () { var td = $(this).text(); //get current td's text var items = {}; //create an empty object items[tr] = td; // add elements to object tdArray.push(items); //push the object to array }); }); </code></pre> <p>Here, I just created an empty object, filled object with references of tr and td, the added that object to the final array.</p> <p>adding a working <a href="https://jsfiddle.net/kp89fd74/" rel="nofollow">jsfiddle</a></p>