Код: Выделить всё
var updatedjsonobj = delete myjsonobj['otherIndustry'];
Ниже приведен мой пример объекта JSON, в котором я хочу удалить ключ «otherIndustry» и его значение.< /p>
Код: Выделить всё
var 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);
Подробнее здесь: https://stackoverflow.com/questions/465 ... -and-value
Мобильная версия