JSFiddle - React, Tailwind, and code Playground
JavaScript
json={"1": {
"id": 1,
"name": "lola",
"phones": [{
"mobile": "xxx",
"home": "xxx",
"work": "xxx",
"hardwares": [{
"provider": "samsung",
"model": "galaxy S5"
}, {
"provider": "apple",
"model": "iphone 6"
}]
}]
}};
json["1"].phones.push({
mobile: "xxxxx",
home: "xxxxx",
work: "xxxxx",
"hardwares": []
});
json["1"].phones[0]['hardwares'].push({
provider: "provider",
model: "model",
});
$.each(json, function(idx,obj){ console.log(obj.phones) })