retrofitを使用してapiからjsonデータを取得しています。ただし、アプリケーションを実行しているときにエラーが表示されています
{"status":true,"message":"Notifications fetched.","data":
[{"id":"69","type":"liked","text":"Sandip Ghosh liked your photo.","for_userid":"56","from_userid":"55","for_image":"54","seen":"0",
"username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""},
{"id":"64","type":"liked","text":"Sandip Ghosh liked your
photo.","for_userid":"56","from_userid":"55","for_image":"54","seen":"0","userna
me":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""}]}
と私のインターフェイスクラス:
public static final String BASE_URL = "http://chikoop.com/api/index.php/";
private static Retrofit retrofit = null;
static Gson gson = new GsonBuilder()
.setLenient()
.create();
public static Retrofit getClient() {
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
}
それは同じで、それは私によって作成されます。私はあなたが存在するjsonデータが私が持っていることを意味します。 –
実際にはデータによって同じですが、無効です。 jsonとhttp://jsonlint.com/またはhttp://www.jsoneditoronline.org/の両方を確認できます。あなたは何がエラーであるかを知るようになります。 – Sanjeet
いいえ、同じプロジェクトで作業している他の人が同じjsonデータをフェッチするのは正しいです。 –