I'm trying to use JS to build a JSON array that looks very much like this:
{
"someKey":"someValue",
"lines":{
"1": {
"someKey": "someValue"
},
"2" {
"someKey": "someValue"
},
}
}
Here's my JavaScript:
var myArray = {
someKey: "someValue",
lines: []
};
var count = 0;
$('.class_that_exists_twice').each(function() {
count ++;
myArray.lines[count] = {
someKey: "someValue",
};
});
However, the array that is returned looks wrong. Any ideas what I'm doing wrong? (Please let me know if I should post the array as well)
Thank you very much!
JSON.stringifylater in order to convert to a JSON array.