javascript数据格式转换

对象数组中转换格式

原数据

let arr = [
        {ducket: [
                { key: 'GET /hlfs', chinese: '90', math: {value:'109'} },
                { key: 'GET /hlfs/_tree', chinese: '110', math: {value:'119'} },
                { key: 'POST /apm-report', chinese: '108', math: {value:'120'} },
              ]
        },
        {ducket: [
                { key: 'GET /hlfs', chinese: '90', math: {value:'119'} },
                { key: 'GET /hlfs/_tree', chinese: '110', math: {value:'115'} },
                ,
              ]
        },  
        {ducket: [
                { key: 'GET /template', chinese: '90', math: {value:'29'} },
                { key: 'GET /hlfs/_tree', chinese: '110', math: {value:'116'} },
                ,
              ]
        },    
]


需要转换成的格式

// {
  // bucket:{
//GET /hlfs:{value:[109119,0]},
// GET /hlfs/_tree:{value:[119115,116]},
// POST /apm-report:{value:[1200,0]}
// GET /template:{value:[0,0,29]}
//}

用双层for没做到(解题思路太局限了,没想到别的办法),请各位指点一下,万分感谢

 var JsonData = JSON.stringify(data);