Answers for "remove object from json array javascript"

0

delete value from json array with index

ArrayList<String> list = new ArrayList<String>();     
JSONArray jsonArray = (JSONArray)jsonObject; 
int len = jsonArray.length();
if (jsonArray != null) { 
   for (int i=0;i<len;i++){ 
    list.add(jsonArray.get(i).toString());
   } 
}
//Remove the element from arraylist
list.remove(position);
//Recreate JSON Array
JSONArray jsArray = new JSONArray(list);
Posted by: Guest on July-20-2020
0

javascript remove json element

jsonArray.splice(2, 1)
meaning : delete 1 item at position 3 ( because array is counted form 0, then item at no 3 is counted as no 2 )
Posted by: Guest on July-08-2020

Code answers related to "remove object from json array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language