Answer the question
In order to leave comments, you need to log in
Why is the MalformedJsonException thrown?
Hello Can you please tell me why I am getting the following error:
04-21 11:35:30.535 14997-15055/com.example.serg.yandextestproject E/AndroidRuntime: FATAL EXCEPTION: Thread-13020
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 890
at com.google.gson.Gson.fromJson(Gson.java:818)
at com.example.serg.yandextestproject.activities.PreviewActivity.run(PreviewActivity.java:102)
at java.lang.Thread.run (Thread.java:856)
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 890
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505)
at com.google.gson.stream.JsonReader. skipQuotedValue(JsonReader.java:1100)
at com.google.gson.stream.JsonReader.skipValue(JsonReader.java:1229)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:170)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
at com.google.gson .internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
at com.google.gson.Gson.fromJson(Gson.java:803)
at com.example.serg.yandextestproject.activities.PreviewActivity.run(PreviewActivity.java:102)
at java.lang.Thread.run(Thread.java :856)
Gson gson = new Gson();
ArrayList<ArtistData> artists = gson.fromJson(new String(data, "UTF-8"), new TypeToken<List<ArtistData>>() {
}.getType());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question