原來數(shù)據(jù)arr1 = [ { bizName:"abc", certName:"食品衛(wèi)生許可證", certType:"餐廳", url:"餐飲食品經(jīng)營許可證.jpg" }, { bizName:"abc", certName:"食品衛(wèi)生許可證", certType:"餐廳", url:"餐飲食品經(jīng)營許可證222.jpg" }, { bizName:"abcd", certName:"食品衛(wèi)生許可證", certType:"餐廳", url:"餐飲食品經(jīng)營許可證222.jpg" },]2.期望得到的數(shù)據(jù)resultArr = [ { name:'abc', arr:[ { bizName:"abc", certName:"食品衛(wèi)生許可證", certType:"餐廳", url:"餐飲食品經(jīng)營許可證.jpg" }, { bizName:"abc", certName:"食品衛(wèi)生許可證", certType:"餐廳", url:"餐飲食品經(jīng)營許可證222.jpg" }, ] }, { name:'abcd', arr:[ bizName:"abcd", certName:"食品衛(wèi)生許可證", certType:"餐廳", url:"餐飲食品經(jīng)營許可證222.jpg" ] }]3.總結(jié):就是按照bizName字段進行歸類
如何根據(jù)id或者指定字段重組數(shù)據(jù)?
侃侃無極
2018-07-06 13:25:02