Js traversal array

    var testData = 
            { 
            "10.1.181.128": [ 
                    { 
                    "fileCount": 121, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "vspp" 
                    }, 
                    { 
                    "fileCount": 1245, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "vspp" 
                    }, 
                    { 
                    "fileCount": 232, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "" 
                    }, 
                    { 
                    "fileCount": 23, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "" 
                    } 
                ], 
                    "10.1.181.126": [ 
                    { 
                    "fileCount": 58, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "vspp" 
                    }, 
                    { 
                    "fileCount": 1755, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "vspp" 
                    }, 
                    { 
                    "fileCount": 7, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "" 
                    }, 
                    { 
                    "fileCount": 7, 
                    "fileSize": 0, 
                    "processResult": "", 
                    "statItem": "" 
                    } 
                    ]
                 ] 
               } 
               

want to get the array of fileCount of vspp, etc. [121pc58]
want to get the array of fileCount of vspp preprocessing engine, etc. [XX,XX]
want to get the array of fileCount of key tone detection engine, etc. [XX,XX]
want to get the array of fileCount of voiceprint recognition engine, etc. [XX,XX]

Mar.16,2022

        let vspp=[];//vspp
        let vsppycl=[];//vspp
        let ajy=[];//
        let sw=[];//
        Object.keys(testData).forEach(key => {
            testData[key].map((item,index) => {
                if(item.statItem=='vspp') vspp.push(item.fileCount);
                if(item.statItem=='vspp') vsppycl.push(item.fileCount);
                if(item.statItem=='') ajy.push(item.fileCount);
                if(item.statItem=='') sw.push(item.fileCount);
            })
        });
        console.log(vspp,vsppycl,ajy,sw);

in order to make it easy to understand, this method of writing should be easy to understand


var keyW = ['vspp','vspp','',''];
var obj={};
for(var k in testData){
  for(var i=0;i<testData[k].length;iPP){
    if(!obj[keyW[i]])  obj[keyW[i]] = [];
    var key = testData[k][i];
    if(obj[key.statItem])
     obj[key.statItem].push(key.fileCount);
  }
}
Menu