I have the following json :
var json_obj:
[{"id":"7","a_id":0,"cost":"Real Cost","desc":"this a value","minage":0,"maxage":""},
{"id":"10","a_id":0,"cost":"Real Cost","desc":"other","minage":0,"maxage":""},
{"id":"13","a_id":0,"cost":"Real Cost","desc":"other","minage":0,"maxage":""}]
I am using this code to remove an element from it by id :
jQuery.each(json_obj, function(i, val) {
if( val.id === 13 ) // delete index
{
delete json_obj[i];
}
});
but it return a json with null value like this :
[{"id":"7","a_id":0,"cost":"Real Cost","desc":"this a value","minage":0,"maxage":""},
{"id":"10","a_id":0,"cost":"Real Cost","desc":"other","minage":0,"maxage":""},
null]
is there a way to return it with out the null value ?