[FIXED] How to fix crash issue on a recycler view due to JsonSyntaxException?

Issue

How to fix crash issue on a recycler view due to JsonSyntaxException?

com.google.gson.JsonSyntaxException: java.lang.NumberFormatException:Expected an int but was 0.5 at line 1 column 39043 path $.items[10].weight

Solution

Solution:

Step-1: Please try to crosscheck your json with your model class

Step-2: If any data type mismatch found, fix it.

Say for an example, if you define your ‘weight’ as an ‘Int’ on your model class and your json data type is ‘double’ then update your model class accordingly.

Step-3: Rebuild your project and run after cleanup.

Answered By – Fazle Rabbi

Answer Checked By – Terry (FixeMe Volunteer)

Leave a Reply

Your email address will not be published.