我在我的android程序中使用Gson庫來解析我的JSON請求。我的Json就是這樣的Json Tag與gson一起返回null
{
"max_rental_rate": "9.00",
"average_rental_rate": "6.00",
"electricity_rate": "0.31",
"water_rate": "2.00",
"direct_line_exchange": "0.04",
"buildings": [
{
"value": "3",
"revision_id": "3"
},
{
"value": "4",
"revision_id": "4"
}
],
"map-image": "<img typeof=\"foaf:Image\"src=\"http://ccims.badrulmi.com/sites/default/files/styles/medium/public/3quarter_view_low.jpg?itok=Ac1mv9U5\" width=\"220\" height=\"165\" />"
}
每一次都在解析,直到我到達地圖圖像。這裏可能是什麼問題?下面的 是我的java代碼。
我解析代碼:
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
MainContainer mainContainer = gson.fromJson(result, MainContainer.class);
和我mainContainer上類
{
private String max_rental_rate;
private String average_rental_rate;
private String electricity_rate;
private String water_rate;
private String direct_line_exchange;
private String direct_line_remarks;
private String internet;
private String internet_remarks;
private ArrayList<Buildings> buildings;
private String mapimage;
}
得到任何幫助。
謝謝你,
希望你添加的getter和setter方法...... – amalBit