How to remove a property from a JSON object?
Published in
2 min readDec 16, 2022
To remove a property from a JSON object in JavaScript, you can use the delete
operator.
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" }