我試圖從API響應的信息訪問JSON的領域使用Groovy遇到問題使用Groovy
我想要去下的「資源」鍵存儲的信息。
沿東西的body.measures.02線:00:00:02:06:70.res
想不通有沒有拋出一個NullPointerException訪問此信息。
"body":[ {
"_id":"70:ee:50:01:fe:96",
"place":{
"location":[
-70.863189,
42.273936
],
"altitude":26.154942,
"timezone":"America\/New_York"
},
"mark":12,
"measures":{
"02:00:00:02:06:70":{
"res":{
"1506611038":[
22,
66
]
},
"type":[
"temperature",
"humidity"
]
},
"06:00:00:01:97:28":{
"wind_strength":15,
"wind_angle":343,
"gust_strength":29,
"gust_angle":301,
"wind_timeutc":1506611083
},
"70:ee:50:01:fe:96":{
"res":{
"1506611086":[
1007.4
]
},
"type":[
"pressure"
]
}
},
"modules":[
"02:00:00:02:06:70",
"06:00:00:01:97:28"
],
"module_types":{
"02:00:00:02:06:70":"NAModule1",
"06:00:00:01:97:28":"NAModule2"
}
}
],
"status":"ok",
"time_exec":0.017483949661255,
"time_server":1506611446
}
你到目前爲止嘗試過什麼? –