I want to insert one or more attributes into the existing JSON. Here's the basic format.
var resultData = {
"result" : "OK",
"data" : [
{"name1" : "value1"},
{"name2" : "value2"}
]
};
And I want to insert {"name3" : "value3"} into the end of the data field. The result should look like this.
var resultData = {
"result" : "OK",
"data" : [
{"name1" : "value1"},
{"name2" : "value2"},
{"name3" : "value3"}
]
};
How do I do this? I know how to add an attribute to the resultData or resultData.result or resultData.data.name1 or etc. However, I couldn't find a way to add an attribute to the resultData.data.