jquery javascript remove object data from JSON object

前端 未结 3 2019
迷失自我
迷失自我 2021-01-03 14:01

I have JSON Object that looks something like the below object, this object can go on for days. So I am wondering is there anyway I can delete full set a set being the equiva

3条回答
  •  庸人自扰
    2021-01-03 14:49

    Simply just pass the index

    delete locations[0];
    

    You go through a normal JSON iteration like this

    jQuery.each(locations, function(i, val) {
       if(val.zipcode == "yourvalue") // delete index
       {
          delete locations[i];
      }
    });
    

    something like that. are you looking for an idea or a complete function.

    Here is the jsFiddle

提交回复
热议问题