1. Object对象
const data = {"banana": [{"color": "yellow","count": 2},{"color": "green","count": 3},{"color": "black","count": 12}],"apple": [{"color": "yellow","count": 3},{"color": "green","count": 31},{"color": "red","count": 20}]
}
2. 转Map
// 方法一
const map = new Map(Object.keys(data).map(key=>[key, data[key]]))
// 方法二
const map = new Map(Object.entries(data).map(([key, value]) => [key, value]));