如果我遍历我的 html 表中的所有单元格并将每个 rowOBj 添加到 tableOBJ 中的一个新属性,它看起来像下面这样但是......
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"}
}
如何使以前的外观使 json 看起来像这样
{
{"name":"fdgd","surname":"ssdt"},
{"name":"fdsf","surname":"vn"},
{"name":"dfsb","surname":"mry"},
{"name":"hsdsdfry","surname":"smh"}
}