JavaScript | Remove a JSON attribute Last Updated : 11 Aug, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will see how to remove a JSON attribute from the JSON object. To do this, there are few of the mostly used techniques discussed. First delete property needs to be discussed. Delete property to Remove a JSON Attribute This keyword deletes a property from an object: 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 properties. It can crash your application. Syntax: delete object.property ordelete object['property']Parameters: object: It specifies the name of an object, or an expression evaluating to an object. property: It specifies the property to delete.Return value: It returns true for all cases and returns false when the property is an own non-configurable property. Example 1: This example deletes the prop_12 from the myObj object via variable key by using delete property. JavaScript let myObj = { 'prop_1': { 'prop_11': 'value_11', 'prop_12': 'value_12' } }; function removeJsonAttr() { let key = "prop_12"; delete myObj.prop_1[key]; console.log(JSON.stringify(myObj)); } removeJsonAttr(); Output{"prop_1":{"prop_11":"value_11"}}Example 2: This example deletes the prop_11 from the myObj object by using delete property. JavaScript let myObj = { 'prop_1': { 'prop_11': 'value_11', 'prop_12': 'value_12' } }; function removeJsonAttr() { delete myObj.prop_1.prop_11; console.log(JSON.stringify(myObj)); } removeJsonAttr(); Output{"prop_1":{"prop_12":"value_12"}} Comment More infoAdvertise with us Next Article JavaScript | Remove a JSON attribute P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JSON Similar Reads JavaScript | Add new attribute to JSON object The task is to add a JSON attribute to the JSON object. To do so, Here are a few of the most used techniques discussed.Example 1: This example adds a prop_11 attribute to the myObj object via var key. html <!DOCTYPE HTML> <html> <head> <title> JavaScript | Add new attribute t 2 min read Remove blank attributes from a JavaScript Object Remove blank attributes from a JavaScript object we have to check if the values are null or undefined and then delete the blank attributes with approaches mentioned below. Table of Content Removing Blank Attributes from a JavaScript ObjectRemoving Null Values from an ObjectRemoving Null and Undefine 4 min read JavaScript JSON Complete Reference JavaScript JSON (JavaScript Object Notation) is a lightweight format for storing and exchanging data. It is easy to read, write, and parse. JSON is based on key-value pairs and arrays.JavaScriptlet data = '{"name":"Raj","age":25}'; let obj = JSON.parse(data); // Convert JSON string to object console 1 min read JavaScript JSON Parser JSON (JavaScript Object Notation) is a popular lightweight data exchange format for sending data between a server and a client, or across various systems. JSON data is parsed and interpreted using a software component or library called a JSON parser. Through the JSON parsing process, a JSON string i 3 min read How to Serialize JSON in JavaScript ? JSON (JavaScript Object Notation) serialization is a fundamental concept in JavaScript, allowing the conversion of JavaScript objects into strings that can be easily transmitted over a network or stored in a file. We will explore how to serialize JSON in JavaScript using JSON.stringify(). Approach I 1 min read Like