5

I am getting MalformedJSONException, unterminated object error. The content of the url passed is unquoted or relaxed json data. Parsing this content works fine when using just Gson alone but when using Retrofit, it throws the above exception after reading the contents of the URL. Is there a way to enable lenient parsing of the content? Main Activity Class is given below

RestAdapter adapter = new RestAdapter.Builder()
    .setEndpoint(ENDPOINT)
    .build();
    Log.d("myinfo","endpoint built");
    QuizAPI api = adapter.create(QuizAPI.class);
    api.getFeed(new Callback<QuizObject>() {

        @Override
        public void success(QuizObject arg0, Response arg1) {
            Log.d("myinfo", "success in callback");
            Log.d("myinfo",arg0.getVersion());
        }

        @Override
        public void failure(RetrofitError arg0) {

            Log.d("myinfo", arg0.getLocalizedMessage());

        }
    });

}
protected void updateDisplay(){
    output.append("updating..");

}
Ganga
  • 597
  • 2
  • 9
  • 23
  • Please see suggested dupe, seems to me that is tightly related. [MalformedJsonException with Retrofit API?](http://stackoverflow.com/questions/27485346/malformedjsonexception-with-retrofit-api) – Nikola Despotoski Jan 08 '15 at 16:07
  • @NikolaDespotoski Thanks.. i found out that the json content was incorrectly formatted at the url. It was one particular line that had its value as an unquoted javascript function and hence the error. But i copied the contents excluding that single line to another file, ran it on a localhost and connected with the url and checked. It works fine. The content needs to be modified at the url. – Ganga Jan 11 '15 at 21:13

0 Answers0