The following error occurred while parsing with Gson.
com.google.gson.stream.MalformedJsonException:Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
Solution:
private final Gson mGson = new GsonBuilder()
.setLenient() // Set the non-strict mode of GSON setLenient()
.create();
private final Retrofit mRetrofit= new Retrofit.Builder()
.baseUrl(BaseUrl)
.client(mOkHttpClient)
.addConverterFactory(GsonConverterFactory.create(mGson))
.build();
Similar Posts:
- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line
- Java.lang.noclassdeffounderror: COM / Google / gson / gson
- [Solved] Maven install failed (package com.google.gson does not exist)
- Android 7.0 Photo Problem: file:///storage/emulated/0/photo.jpeg exposed beyond app through ClipData.Item.getUri
- MYSQL Insert: SQLSTATE[HY000]: General error: 1364 Field ‘xxxxx’ doesn’t have a default value
- Laravel Syntax error or access violation: 1055 ‘***’ isn’t in GROUP BY
- Consider defining a bean of type ‘xxx’ in your configuration. Autowired(required=true)
- [How to Solve] Eclipse: Errors occurred during the build
- SSL connection error: javax.net.ssl.sslhandshakeexception
- incorrect integer value for column [How to Solve]