1. 程式人生 > >關於JSON 鍵值對 轉換 需要得到值

關於JSON 鍵值對 轉換 需要得到值

 let s = { "age": [{ "FPA_19_25": "19~25" }, { "FPA_26_35": "26~35" }, { "FPA_36_45": "36~45" }], "Province": [{ "FPP_BEIJING": "北京" }, { "FPP_HEBEI": "河北" }] }
        let sb = { age:[]};
        s.age.forEach(item => {
            for (var key in item) {
                console.log(key);
                console.log(item[key])
                sb.age.push(item[key])
            }
        });
        console.