Having problems creating the object structure. I want a structure like this:
{
"BFO": {
"1": {
"text1": "100",
"text2": "200",
"text3": "300"
},
"2": {
"text1": "400",
"text2": "500",
"text3": "600"
}
}
}
I am creating the object with an each iteration in jquery:
function objects() {
var BFO = new Object();
BFO["BFO"] = new Object();
$("tr").each(function(i) {
BFO["BFO"][i] = new Object();
BFO["BFO"][i]["text1"]="test";
BFO["BFO"][i]["text2"]="test";
BFO["BFO"][i]["text3"]="test";
});
This generates:
{"BFO":[{"text1":"test","text2":"test","text3":"test"},{"text1":"test","text2":"test","text3":"test"}]}
}
}
Almost there but missing the 1, 2 etc and there are [] characters I don't need. Any help to complete appreciated.