if I loop through all the cells in my html table and add each rowOBj to a new property in the tableOBJ it looks like this below BUT….
var tableOBJ = {};
$("table tr").each(function (index, value) {
var r = new rowOBJ(
$(this).find('td').eq(0).text(),
$(this).find('td').eq(1).text()
);
tableOBJ[index] = r;
});
var p = JSON.stringify(tableOBJ);
p =
{
"0":{"name":"fdgd","surname":"ssdt"},
"1":{"name":"fdsf","surname":"vn"},
"2":{"name":"dfsb","surname":"mry"},
"3":{"name":"hsdsdfry","surname":"smh"}
}
How do I make the previous look make the json look like this
{
{"name":"fdgd","surname":"ssdt"},
{"name":"fdsf","surname":"vn"},
{"name":"dfsb","surname":"mry"},
{"name":"hsdsdfry","surname":"smh"}
}
would it help if tableOBJ is an array?
Then in your loop instead of setting the index of an object push the array: