如何向此对象添加元素

如果我有这个结构

var data = { "people": [ { "name" : "John", "id" : 1 }, { "name" : "Marc", "id" : 2 } ] } 

我想在JavaScript中添加更多元素,特别是在jQuery中,然后像这样发送它

 var dataString = JSON.stringify(data); $.post('some.php', { data: dataString}, showResult, "text"); 

 var data = { "people": [ { "name" : "John", "id" : 1 }, { "name" : "Marc", "id" : 2 } ] } data["people"].push({"name": "foo", "id": 3}); console.log(data); 

http://jsfiddle.net/RK4bx/