I have the following code that does not work. I am trying to push the text "John" onto the end of the object. I am more familiar with PHP, and this works in PHP.
var data = {};
var field_name = "first_name";
data[field_name]['answers'][] = "John";
alert(data['first_name']['answers'][0]);
Edit:
I also tried the following and it did not work.
var data = {};
var field_name = "first_name";
var i=0;
data[field_name]['answers'][i] = "John";
alert(data['first_name']['answers'][0]);