I've got a JSON string and this is just a part of it:
"geoLocation":{
"latitude": 46.05570,
"longitude": 14.50705,
},
I've also got a custom class and I'm trying to use GSON to get array of objects from this JSON like this:
locationList = gson.fromJson(responseString, Location[].class);
But the app crashes on the line above and this is the Logcat:
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected name at line 15 column 6 path $[0].geoLocation.
This is how the part of the class with geoLocation variables looks like:
public class Location {
...
private double latitude;
private double longitude;
...
}
Any idea why I'm getting the crash?
"geoLocation":{
"latitude": 46.05570,
"longitude": 14.50705,
}
comma after longitude is invalid. Remove it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With