javascript - Remove item from json array using its random ids -
i have array contains values follows:
{ "123456": { "name": "tom", "projects": { "987654": { "cli": "abcd", "org": "123456", "cli_e": "abcd", "pro": "abcd", "status": "6" } } } }, { "654321": { "name": "jerry", "projects": { "123": { "cli": "xyz", "org": "000", "cli_e": "xyz", "pro": "xyz", "status": "3" } } } }
i want output below:
{ "cli": "abcd", "org": "123456", "cli_e": "abcd", "pro": "abcd", "status": "6" }, { "cli": "xyz", "org": "000", "cli_e": "xyz", "pro": "xyz", "status": "3" }
how that?
got answer hsz
var output = []; (var k in input) { (var kk in input[k].projects) { output.push(input[k].projects[kk]); } }
Comments
Post a Comment