我最近開始使用Retrofit。我對此不甚瞭解。我GOOGLE了這個問題,沒有答案套件我的問題。JSON解析與改造
這是這是訂閱
類public class Feed {
public List<Results> results;
class Results{
String description_eng,img_url,title_eng;
}
}
這是接口
public interface GetApi {
@GET("/api.json")
public void getData(Callback<List<Feed>> response);
}
我json_illegal_syntax Exception
JSON響應
{
"results": [
{
"description_eng": "This is second time testing",
"img_url": "-",
"title_eng": "Second test"
},
{
"description_eng": "Hello 1 2 3, I am testing.",
"img_url": "https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-xpa1/t31.0-8/s720x720/10838273_816509855058935_6428556113200361121_o.jpg",
"title_eng": "Test"
}
]
}
。
設法使「結果」類的靜態,爲你設計的,它作爲一個內部類。 –
不工作的兄弟。 –
好的。你有沒有嘗試用http://jsonformatter.curiousconcept.com這樣的東西解析響應JSON?如果這是一個「非法語法」錯誤,它應該告訴你。 –