delete operator is used to remove an object property.

delete operator does not returns the new object, only returns a boolean: true or false.

In the other hand, after interpreter executes var updatedjsonobj = delete myjsonobj['otherIndustry']; , updatedjsonobj variable will store a boolean value.

How to remove Json object specific key and its value ?

You just need to know the property name in order to delete it from the object's properties.

delete myjsonobj['otherIndustry'];

let myjsonobj = {
  "employeeid": "160915848",
  "firstName": "tet",
  "lastName": "test",
  "email": "test@email.com",
  "country": "Brasil",
  "currentIndustry": "aaaaaaaaaaaaa",
  "otherIndustry": "aaaaaaaaaaaaa",
  "currentOrganization": "test",
  "salary": "1234567"
}
delete myjsonobj['otherIndustry'];
console.log(myjsonobj);

If you want to remove a key when you know the value you can use Object.keys function which returns an array of a given object's own enumerable properties.

let value="test";
let myjsonobj = {
      "employeeid": "160915848",
      "firstName": "tet",
      "lastName": "test",
      "email": "test@email.com",
      "country": "Brasil",
      "currentIndustry": "aaaaaaaaaaaaa",
      "otherIndustry": "aaaaaaaaaaaaa",
      "currentOrganization": "test",
      "salary": "1234567"
}
Object.keys(myjsonobj).forEach(function(key){
  if (myjsonobj[key] === value) {
    delete myjsonobj[key];
  }
});
console.log(myjsonobj);

Answer from Mihai Alexandru-Ionut on Stack Overflow
Top answer
1 of 7
129

delete operator is used to remove an object property.

delete operator does not returns the new object, only returns a boolean: true or false.

In the other hand, after interpreter executes var updatedjsonobj = delete myjsonobj['otherIndustry']; , updatedjsonobj variable will store a boolean value.

How to remove Json object specific key and its value ?

You just need to know the property name in order to delete it from the object's properties.

delete myjsonobj['otherIndustry'];

let myjsonobj = {
  "employeeid": "160915848",
  "firstName": "tet",
  "lastName": "test",
  "email": "test@email.com",
  "country": "Brasil",
  "currentIndustry": "aaaaaaaaaaaaa",
  "otherIndustry": "aaaaaaaaaaaaa",
  "currentOrganization": "test",
  "salary": "1234567"
}
delete myjsonobj['otherIndustry'];
console.log(myjsonobj);

If you want to remove a key when you know the value you can use Object.keys function which returns an array of a given object's own enumerable properties.

let value="test";
let myjsonobj = {
      "employeeid": "160915848",
      "firstName": "tet",
      "lastName": "test",
      "email": "test@email.com",
      "country": "Brasil",
      "currentIndustry": "aaaaaaaaaaaaa",
      "otherIndustry": "aaaaaaaaaaaaa",
      "currentOrganization": "test",
      "salary": "1234567"
}
Object.keys(myjsonobj).forEach(function(key){
  if (myjsonobj[key] === value) {
    delete myjsonobj[key];
  }
});
console.log(myjsonobj);

2 of 7
22

There are several ways to do this, lets see them one by one:

  1. delete method: The most common way

const myObject = {
    "employeeid": "160915848",
    "firstName": "tet",
    "lastName": "test",
    "email": "test@email.com",
    "country": "Brasil",
    "currentIndustry": "aaaaaaaaaaaaa",
    "otherIndustry": "aaaaaaaaaaaaa",
    "currentOrganization": "test",
    "salary": "1234567"
};

delete myObject['currentIndustry'];
// OR delete myObject.currentIndustry;
  
console.log(myObject);

  1. By making key value undefined: Alternate & a faster way:

let myObject = {
    "employeeid": "160915848",
    "firstName": "tet",
    "lastName": "test",
    "email": "test@email.com",
    "country": "Brasil",
    "currentIndustry": "aaaaaaaaaaaaa",
    "otherIndustry": "aaaaaaaaaaaaa",
    "currentOrganization": "test",
    "salary": "1234567"
  };

myObject.currentIndustry = undefined;
myObject = JSON.parse(JSON.stringify(myObject));

console.log(myObject);

  1. With es6 spread Operator:

const myObject = {
    "employeeid": "160915848",
    "firstName": "tet",
    "lastName": "test",
    "email": "test@email.com",
    "country": "Brasil",
    "currentIndustry": "aaaaaaaaaaaaa",
    "otherIndustry": "aaaaaaaaaaaaa",
    "currentOrganization": "test",
    "salary": "1234567"
};


const {currentIndustry, ...filteredObject} = myObject;
console.log(filteredObject);

Or if you can use omit() of underscore js library:

const filteredObject = _.omit(currentIndustry, 'myObject');
console.log(filteredObject);

When to use what??

If you don't wanna create a new filtered object, simply go for either option 1 or 2. Make sure you define your object with let while going with the second option as we are overriding the values. Or else you can use any of them.

hope this helps :)

Discussions

How to "remove" a key/value in a JSON object?
We can reset an entire variable but not a path. (reset variable value) We can update a path but not delete. I can set null, but that’s not the same thing. (change variable value). Setting to null will add bloat to my JSON unecessarily. So how do I delete the key in a nested JSON object variable? More on community.weweb.io
🌐 community.weweb.io
2
0
April 15, 2024
Remove key property from JSON object using javascript - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Ask questions, find answers and collaborate at work with Stack Overflow for Teams More on stackoverflow.com
🌐 stackoverflow.com
Extension: JSON Keys Remover
Cool, but you can pretty easily achieve the same thing with native VSCode commands though: https://streamable.com/ljp8ad Here I do these: Select the key Do the "Select all occurrences" command Do the "Delete line" command Erase the comma while keeping multi-cursor With shortcuts for the commands, it can be done in seconds using keyboard only More on reddit.com
🌐 r/vscode
7
3
March 30, 2024
Best way to delete undefined values from an object
If you only want to remove the properties that are undefined, but null is ok, then use this: for (let key in person) { if(person[key] === undefined) { delete person[key] } } If you also want to remove properties that are null, then just remove the && person[key] !== null part. More on reddit.com
🌐 r/node
7
3
July 20, 2017
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-remove-element-from-json-object-in-javascript
JSON File Remove Operations in Node.js - GeeksforGeeks
January 17, 2026 - ... let jObj = { "company": "GeeksforGeeks", "courses": ["DSA", "Web Tech", "Placement_Preparation", "DDA"] }; delete jObj.courses; console.log(jObj); ... filter method removes a property from a JSON object by filtering key-value pairs and ...
🌐
Hdtuto
hdtuto.com › article › how-to-remove-key-value-from-javascript-object
How to remove key value from javascript object? - HDTuto.com
February 22, 2019 - Today's topic is how we can delete object key in javascript with example. if you require to remove key value from your existing jquery object then you can do it using delete operator. we can simply remove specific index from object array. Object class have a delete operator. delete operator ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-remove-a-key-from-javascript-object
How to remove a key-value pair from JavaScript object? - GeeksforGeeks
While the filter() method works directly on arrays, objects in JavaScript are not directly filterable like arrays. However, we can convert an object’s keys or entries into an array and then apply the filter() method to remove unwanted key-value ...
Published   July 23, 2025
🌐
Pluralsight
pluralsight.com › blog › tech guides & tutorials
Delete Data from JSON Using a Key in React | Pluralsight
Use the parse function to convert ...,"1234567890"]}'; let jsonObj = JSON.parse(jsonStr); The delete operator can be used to remove a key-value pair from a JavaScript object:...
🌐
The Web Dev
thewebdev.info › home › how to remove json object key and value with javascript?
How to remove JSON object key and value with JavaScript? - The Web Dev
July 17, 2022 - To remove JSON object key and value with JavaScript, we use the delete operator. ... const myObject = { employeeid: "888888", firstName: "tet", lastName: "test", email: "test@email.com", country: "Brasil", currentIndustry: "aaaaaaaaaaaaa", ...
🌐
Koding Made Simple
kodingmadesimple.com › 2017 › 04 › add-remove-key-value-pairs-from-json-javascript.html
Add/Remove Key Value Pairs (Attributes) from JSON Data using JavaScript
In JSON, data is stored as key - value pairs and wrapped within quotes since it's a string. Sometimes the key-value pairs are also referred to as attributes, items or elements. Here I'm going to show you how to append or remove key value pairs from existing json data.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › removing-property-from-a-json-object-in-javascript
Removing property from a JSON object in JavaScript
September 23, 2022 - By using the delete operator, we have deleted the name value in the object. <!DOCTYPE html> <html> <head> <title>Deleting property of an JSON object.</title> </head> <body> <p id="para"></p> <script> var Cricketer = { 'name': "Dhoni", 'role': "Keeper-batsmen", 'age': 41, 'bat': "Right", }; ...
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-remove-element-from-json-object-in-javascript
How to Remove Element from JSON Object in JavaScript ? | GeeksforGeeks
April 16, 2024 - The approaches to accomplish this task are listed and discussed below: ... In this approach, we are using the delete keyword to directly remove a specific key from the JSON object.
🌐
GitHub
gist.github.com › 3d44c7228fa8cfe8097daa2f7e2b476c
Recursively remove json keys in an array · GitHub
Recursively remove json keys in an array. GitHub Gist: instantly share code, notes, and snippets.
🌐
Medium
medium.com › knowledge-pills › how-do-i-remove-a-property-from-a-json-object-fd7ec14d37bd
How to remove a property from a JSON object? | by Fuji Nguyen | Knowledge Pills | Medium
January 8, 2024 - Here is an example of how to use the delete operator to remove the property age from a JSON object: let obj = { name: "John", age: 30, occupation: "developer" }; delete obj.age; console.log(obj); // Output: { name: "John", occupation: "developer" ...
🌐
codelessgenie
codelessgenie.com › blog › remove-key-value-pair-from-json-object
How to Remove a Key-Value Pair from an Array of JSON Objects in JavaScript: Correct Method Explained — CodeLessGenie.com
Removing a key-value pair from an array of objects in JavaScript is straightforward once you choose between mutable and immutable approaches:
🌐
WeWeb Community
community.weweb.io › ask us anything › how do i?
How to "remove" a key/value in a JSON object? - How do I? - WeWeb Community
April 15, 2024 - We can reset an entire variable but not a path. (reset variable value) We can update a path but not delete. I can set null, but that’s not the same thing. (change variable value). Setting to null will add bloat to my JSON unecessarily. So how do I delete the key in a nested JSON object variable?
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-delete-an-index-from-json-object
How to delete an index from JSON Object ? | GeeksforGeeks
September 13, 2024 - Now, to delete any index from this JSON object, we will learn different methods that are explained below - ... The delete operator in JavaScript is used to remove a property from an object.
🌐
Stack Overflow
stackoverflow.com › questions › 45010542 › remove-key-property-from-json-object-using-javascript
Remove key property from JSON object using javascript - Stack Overflow
My initial object: var data=[ { "parent":104, "child":130, "grandChild":755, "greatGrandChild":576 }, { "parent":106 }, { "parent":109 } ] The code to generate the o...
🌐
GitHub
github.com › miktam › key-del
GitHub - miktam/key-del: Delete nested keys from Javascript object
var deleteKey = require('key-del') var originalObject = { one: 1, two: 2, three: { nestedOne: 3, nestedTwo: 4 } } var result = deleteKey(originalObject, ['one', 'nestedOne']) console.log(result) // {two: 2, three: {nestedTwo: 4}} // Delete nested key by full path var objectToDeleteKeyFrom = { one: 1, two: 2, nested: {two: 2, three: 3}} var keyToDelete = 'nested.two' var result = delKey(objectToDeleteKeyFrom, keyToDelete) console.log(result) // { one: 1, two: 2, nested: {three: 3}}
Starred by 15 users
Forked by 3 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-remove-a-json-attribute
JavaScript | Remove a JSON attribute | GeeksforGeeks
August 11, 2023 - In this article, we will see how ... from the JSON object. To do this, there are few of the mostly used techniques discussed. First delete property needs to be discussed. ... This keyword deletes both the value of the property and the property itself. After deletion, the property is not available for use before it is added back again. This operator is created to be used on object properties, not on variables or functions. This operator should not be used on predefined JavaScript object ...
🌐
Ksrae
ksrae.github.io › javascript › remove-json-key
Remove a Specific Key Value in JSON Dynamically - The Developer’s Notebook: Angular and Beyond
August 14, 2022 - Removing specific entries from ... presents a challenge. A common, but suboptimal, approach involves creating a new JSON variable and manually reconstructing the object, excluding the desired entries....