JSON Delete a Key from an object

You are Here:

JSON Deleting Keys from the object

In the following example, we will delete keys (married and partner) from the first object in an array (data) by using JSON's dot notation and bracket notation.


HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Deleting a Key from the object</h1> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Mike", "age": 36, "married": true, "partner": "Jade" } ] function myFunction(){ // Deleting a key (married) from the first object by using dot notation delete data[0].married; // Deleting a key (partner) from the first object by using bracket notation delete data[0]["partner"]; console.log(data); } </script> </body> </html>


delete obj.key; //or delete obj["key"];


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