delete json js code example
Example 1: deleting key of json object
let myjsonobj = {
"employeeid": "160915848",
"firstName": "tet",
"lastName": "test",
"email": "[email protected]",
"country": "Brasil",
"currentIndustry": "aaaaaaaaaaaaa",
"otherIndustry": "aaaaaaaaaaaaa",
"currentOrganization": "test",
"salary": "1234567"
}
delete myjsonobj['otherIndustry'];
console.log(myjsonobj);
Example 2: javascript remove json element
jsonArray.splice(2, 1)
meaning : delete 1 item at position 3 ( because array is counted form 0, then item at no 3 is counted as no 2 )