0
在我的Android 應用我有以下JSON字符串成地圖轉換。我JSON數組跟隨,轉換JSON價值的關鍵削減到一個HashMap
[
{
"WindDirection": {
"id": "3",
"wind_direction": "East",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "14",
"wind_direction": "East NorthEast",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "15",
"wind_direction": "East SouthEast",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "1",
"wind_direction": "North",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "10",
"wind_direction": "North NorthEast",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "11",
"wind_direction": "North NorthWest",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "7",
"wind_direction": "North West",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "6",
"wind_direction": "NorthEast",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "4",
"wind_direction": "South",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "12",
"wind_direction": "South SouthEast",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "13",
"wind_direction": "South SouthWest",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "8",
"wind_direction": "SouthEast",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "9",
"wind_direction": "SouthWest",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "2",
"wind_direction": "West",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "16",
"wind_direction": "West NorthWest",
"is_deleted": false
}
},
{
"WindDirection": {
"id": "17",
"wind_direction": "West SouthWest",
"is_deleted": false
}
}
]
我希望把id和風向成哈希映射。這樣做的最簡單方法是什麼?