如何删除json jquery数组中的值?

如何删除json jquery数组中的值?,jquery,Jquery,我的php文件返回了一个充满值的json数组 $positions = array(); while($row = mysqli_fetch_assoc($abfrage)){ array_push( $positions, array('posID' => $row['posID'],'pos1' => $row['pos1'], 'pos2' => $row['pos2'])); } @mysql_close($connection); echo jso

我的php文件返回了一个充满值的json数组

$positions = array();
while($row = mysqli_fetch_assoc($abfrage)){
array_push( $positions, array('posID' => $row['posID'],'pos1' => $row['pos1'], 'pos2' => $row['pos2']));        

}

@mysql_close($connection);
echo json_encode(array("positions" => $positions));
exit; 
现在在我的js文件中,我想删除一个数据集,例如posID==x, 但是我不知道怎么做

$.each(positions, function(i, v){
   if(v.posID == id){
 ... delete data set ...
}
});

请帮忙

使用要保留的项目创建一个新数组:

var result = $.grep(positions, function(v){
  return v.posID != id;
});