var json = { ... };
var key = "foo";
delete json[key]; // Removes json.foo from the dictionary.

You can use splice to remove elements from an array.

Answer from dteoh on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-remove-element-from-json-object-in-javascript
JSON File Remove Operations in Node.js - GeeksforGeeks
January 17, 2026 - The delete keyword removes a specific property from a JSON object, and the updated structure can be verified using the console. Removes a key-value pair directly from the object.
🌐
TutorialsPoint
tutorialspoint.com › remove-json-element-javascript
Remove json element - JavaScript?
November 3, 2023 - Use delete for removing object properties, splice() for removing array elements by index, and filter() for conditional removal.
🌐
ArduinoJson
arduinojson.org › version 6 › api › jsonarray › remove()
JsonArray::remove() | ArduinoJson 6
JsonArray::remove() removes the element at the specified index from the array pointed by the JsonArray.
Top answer
1 of 2
1

You'll have to iterate over the addressesFound array, and in each object iterate over the keys of that object, compare if that key exists in addressNonRequired array and remove it, if applicable.

var addressesFound = [{
    "addr_id": "41d86d46-8b19-4f4e-be03-f9915ef4947b",
    "addr_type": "postal",
    "addr_linkid_usr": "user1",
    "addr_created": "2021-03-10",
    "addr_updated": "",
    "addr_active": true,
    "addr_postal_as_residential": false,
    "addr_international": false,
    "addr_autocomplete_id": null
  },
  {
    "addr_id": "b18c2ca6-29cf-4114-9067-b37fd3394638",
    "addr_type": "residential",
    "addr_linkid_usr": "user1",
    "addr_created": "2021-03-10",
    "addr_updated": "",
    "addr_active": true,
    "addr_postal_as_residential": true,
    "addr_international": true,
    "addr_autocomplete_id": "string"
  }
];

const addressNonRequired = ["addr_linkid_usr", "addr_created", "addr_updated"];

var updatedAddresses = addressesFound.map(function(address) {
    Object.keys(address).forEach(function(key) { // For each address object, iterate over the keys
    if (addressNonRequired.includes(key)) {
      delete address[key]; // Check if the key is present in the addressNonRequired array. Delete if present
    }
  });
  return address;
});

console.log(updatedAddresses);

2 of 2
0

I always use this very often when filtering an object or an array of objects.

I usually have these in my helpers.ts file. They also make sure that the keys you are filtering does exist in the object and it also has autocomplete.

export function except<T, K extends keyof T>(data: T, keys: Array<K>) {
    const copy = { ...data };
    for (const key of keys) {
        if (key in copy) {
            delete copy[key];
        }
    }
    return copy;
}

export function exceptMany<T, K extends keyof T>(data: Array<T>, keys: Array<K>) {
    return [...data].map((item) => except(item, keys));
}

Then to filter an array of objects, we do:

const data = [
  {
    "addr_id": "41d86d46-8b19-4f4e-be03-f9915ef4947b",
    "addr_type": "postal",
    "addr_linkid_usr": "user1",
    "addr_created": "2021-03-10",
    "addr_updated": "",
    "addr_active": true,
    "addr_postal_as_residential": false,
    "addr_international": false,
    "addr_autocomplete_id": null
  },
  {
    "addr_id": "b18c2ca6-29cf-4114-9067-b37fd3394638",
    "addr_type": "residential",
    "addr_linkid_usr": "user1",
    "addr_created": "2021-03-10",
    "addr_updated": "",
    "addr_active": true,
    "addr_postal_as_residential": true,
    "addr_international": true,
    "addr_autocomplete_id": "string"
  }
];

const results = exceptMany(data, ['addr_linkid_usr', 'addr_created', 'addr_updated']);

Filtering keys from just one object is also possible:

const single = {
    "addr_id": "41d86d46-8b19-4f4e-be03-f9915ef4947b",
    "addr_type": "postal",
    "addr_linkid_usr": "user1",
    "addr_created": "2021-03-10",
    "addr_updated": "",
    "addr_active": true,
    "addr_postal_as_residential": false,
    "addr_international": false,
    "addr_autocomplete_id": null
};

const filteredSingle = except(single, ['addr_linkid_usr', 'addr_created', 'addr_updated']);
🌐
TutorialsPoint
tutorialspoint.com › removing-property-from-a-json-object-in-javascript
Removing property from a JSON object in JavaScript
The Delete operator is the easiest way to delete the object property. if we want to delete multiple properties which are in the object, we need to use this operator multiple times. In the following example, we have created a JSON Object with keys and values.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-remove-element-from-json-object-in-javascript
How to Remove Element from JSON Object in JavaScript ? - GeeksforGeeks
August 5, 2025 - Finally, we use Object.fromEntries to convert the filtered array back into a JSON object. let updatedObject = Object.fromEntries( Object.entries(originalObject).filter( ([key, value]) => /* condition to keep or remove key */) ); Example: The below example uses the filter Method to remove an element from JSON object in JavaScript.
Find elsewhere
🌐
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 - The delete operator removes the specified property from the object and returns true if the property was successfully deleted. If the property does not exist or cannot be deleted (e.g. if it is non-configurable), the delete operator returns false.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-remove-specific-json-object-from-array-javascript
How To Remove Specific JSON Object From Array JavaScript? | GeeksforGeeks
April 18, 2024 - In this approach, we are using a for loop to iterate through the jData array, checking each object's "Name" property until finding the desired object ("Trees"). Once found, we use the splice() method to remove the object at the found index, making ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-remove-a-json-attribute
JavaScript | Remove a JSON attribute | GeeksforGeeks
August 11, 2023 - Table of Content Removing Blank Attributes from a JavaScript ObjectRemoving Null Values from an ObjectRemoving Null and Undefine ... In JavaScript, removing duplicates from a JSON array is important for data consistency and efficient processing. We will explore three different approaches to remove duplicates in JSON array JavaScript.
🌐
Tech Solution Stuff
techsolutionstuff.com › post › how-to-remove-specific-json-object-from-array-javascript
How To Remove Specific JSON Object From Array Javascript
March 29, 2024 - const arr = [ {id: "1", name: "car", type: "vehicle"}, {id: "2", name: "bike", type: "vehicle"}, {id: "3", name: "cycle", type: "vehicle"}, {id: "4", name: "red", type: "color"}, {id: "5", name: "green", type: "color"}, {id: "6", name: "blue", type: "color"}, ]; const removeById = (arr, id) => { const requiredIndex = arr.findIndex(el => { return el.id === String(id); }); if(requiredIndex === -1){ return false; }; return !!arr.splice(requiredIndex, 1); }; removeById(arr, 5); console.log(arr);
🌐
Sentry
sentry.io › sentry answers › javascript › removing properties from objects in javascript
Removing Properties from Objects in JavaScript | Sentry
July 6, 2022 - Use the delete operator to remove a property from an object. let person = { firstName: "John", lastName: "Doe", gender: "Male", age: 34 }; // Delete the age property first delete person.age; let json = JSON.stringify(person); console.log(json);
🌐
GitHub
gist.github.com › usmansbk › 3d44c7228fa8cfe8097daa2f7e2b476c
Recursively remove json keys in an array · GitHub
Recursively remove json keys in an array. GitHub Gist: instantly share code, notes, and snippets.
🌐
Pluralsight
pluralsight.com › tech insights & how-to guides › tech guides & tutorials
Delete Data from JSON Using a Key in React | Pluralsight
November 9, 2020 - The delete operator can be used to remove a key-value pair from a JavaScript object: delete jsonObj.name; /* after delete { age: 10, phone: ["1234567890", "1234567890"] } */ Alternately, string keys can be used to delete a key-value pair: ... ...
🌐
openHAB Community
community.openhab.org › setup, configuration and use › scripts & rules
How to delete an element from nested JSON array - Scripts & Rules - openHAB Community
August 30, 2019 - I have this JSON which holds the configuration for my livingroom scenes { "ON" : [ { "ItemName" : "z_l_table", "Value" : "ON" }, { "ItemName" : "z_l_janine", "Value" : "ON" } ], "OFF" : [ { "ItemName" : "z_l_table", ...