JSON Delete an Object

You are Here:

JSON Delete Object from Array

Use Array.splice() inbuilt javascript method to delete a specific object from an array.

In the following example, we will delete the second object from an array (data) by using Array.splice() inbuilt javascript method.


HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Deleting an Object</h1> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Mike", "age": 36 }, { "name": "Jack", "age": 28 }, ] function myFunction(){ // Delete jack (object) from data data.splice(1, 1); console.log(data); } </script> </body> </html>


arrObj.splice(startIndex, deleteCount);

Parameter Values

startIndexSpecifies the position at which the element to be removed.
A negative index can be used to specifies the position from reverse order i.e., from right to left.
If omitted, the default value is '0'.
deleteCountSpecifies the number of items to be removed.
If deleteCount is 0 or negative, no elements are removed.
If omitted, the default value is the 'length of an array' - 'startIndex'.


Hi Developers, we almost covered 100% of JSON Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JSON.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author