Is there a way to add a new ID to my data array without creating a new object for each addition?
Existing Data:
[{"devices":{"dID":"TLSM01"},"uuid":"e863c776-f939-4761-bbce-bf0501b42ef7"},
{"devices":{"dID":"TLSM01"},"uuid":"5a0cd70d-891d-48d8-b205-e92e828ac445"}]
New Data to Add:
{"EntityID":"12458412548"}
Desired Result:
[{"devices":{"dID":"TLSM01","EntityID":"12458412548"},"uuid":"e863c776-f939-4761-bbce-bf0501b42ef7"},
{"devices":{"dID":"TLSM01","EntityID":"12458412548"},"uuid":"5a0cd70d-891d-48d8-b205-e92e828ac445"}]
Code Snippet:
var data = [{
"devices": {
"dID": "TLSM01"
},
"uuid": "e863c776-f939-4761-bbce-bf0501b42ef7"
}, {
"devices": {
"dID": "TLSM01"
},
"uuid": "5a0cd70d-891d-48d8-b205-e92e828ac445"
}]
data.push({
"EntityID": "test"
});
console.log(data);