How to fix number format exception in gson while parsing json | How to fix numberformatexception
🔴 Subscribe for more free Tutorials and Tips: http://bit.ly/Sub2HtopSkills
If this video helped you, don't forget to LIKE & SHARE IT!
===========
Links You May Want: https://htopskills.com/bookmark
===========
Check-out these videos:
How to check if YouTube channel is streaming live | kotlin tutorial
http://bit.ly/checkIfYTchannelLive
How to add Intellij idea project to GitHub
http://bit.ly/IntellijprojecttoGitHub
Get channel URL on a YouTube video | Parse Json Response Using Gson | kotlin tutorial
http://bit.ly/ParseJsonwithGsonKotlin
How to convert google spreadsheet to json / export json from google sheets
http://bit.ly/jsonfromspreadsheets
How to fix no main manifest attribute / Create Jar File in Kotlin/Won't load / can't play
http://bit.ly/Kotlinnomainmanifestatt...
How to add twitter4j dependency in gradle project
http://bit.ly/twitter4jdependencygradle
===================
📥 SPONSORS / Personal help :
Want me to promote your product or need help? Contact for rates https://htopskills.com/contact/
==========
Let's connect
Website: https://htopskills.com
YouTube: https://htopskills.com/youtube
Facebook: / htopskills
Twitter: https://htopskills.com/twitter
Instagram: https://htopskills.com/instagram
===================
This is the error:
Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 4.61 at line 29 column 40 path $.feed.entry[0].media:group.media:community.media:starRating.average
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:228)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:218)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.Gson.fromJson(Gson.java:927)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
at VideoIDChannelIDKt.getVideID(VideoIDChannelID.kt:21)
at VideoIDChannelIDKt.main(VideoIDChannelID.kt:9)
at VideoIDChannelIDKt.main(VideoIDChannelID.kt)
Caused by: java.lang.NumberFormatException: Expected an int but was 4.61 at line 29 column 40 path $.feed.entry[0].media:group.media:community.media:starRating.average
at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1204)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:226)
... 23 more
======================
Tags:
#gson #json #java #kotlin #howto #techtip #htopskills #developer #apps #dev #android #AndroidDev #AppDev