I am getting error like
retrofit.RetrofitError: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 7 path $
And I tried 1 answer of this MalformedJsonException with Retrofit API?1, I am using retrofit 1.8, what should I do?
My Java code:
RetroHelper
public static RestAdapter getAdapter(Context ctx, String serverUrl) {
mContext=ctx;
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(StringConstants.BASE_CLASSES_URL+serverUrl)
.setLogLevel(RestAdapter.LogLevel.FULL).setLog(new RestAdapter.Log() {
@Override
public void log(String msg) {
Log.i("Retro Helper", msg);
}
})
.build();
JSON response
{
"status": "Success",
"data": null,
"message": "Successfully get the slot lists",
"statusCode": 200
}
other code
public ServiceOperations getBaseClassService(Context ctx, String url) {
return new RetroHelper().getAdapter(ctx, url).create(ServiceOperations.class);
}
@GET("/schduleLists")
void getDoctorSchedule(@Query("doctorid") int id, Callback<JsonObject> callback);
mUtil.getBaseClassService(getActivity(), "").getDoctorSchedule(mUserId,new Callback<JsonObject>() {
@Override
public void success(JsonObject jsonObject, Response response) {
if (jsonObject.get(StringConstants.STATUS).getAsString().equalsIgnoreCase("Success")) {// this if condition is casued error!
mUtil.dismissDialog();
JsonArray jsonArray =jsonObject.get("data").getAsJsonArray();