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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -