JSON inconsistencies: reverse lookups return lat/lng as numbers, forward lookups return them as strings.
abtrout opened this issue · 2 comments
abtrout commented
I just ran into an issue where my JSON parser was failing because lat
and lng
are returned as strings for geocoding lookups, but returned as numbers for reverse geocoding lookups.
For example:
# https://api.geocod.io/v1/reverse?q=38.9002898,-76.9990361&api_key=API_KEY
"location": {
"lat": 38.900203,
"lng": -76.999507
}
# https://api.geocod.io/v1/geocode?q=washington+dc&api_key=API_KEY
"location": {
"lat": "38.893311",
"lng": "-77.014647"
}
According to your documentation (geocoding lookup, reverse geocoding lookup), they should be returned as numbers in both situations.
MiniCodeMonkey commented
Hi,
Nice catch! And sorry about that.
It looks like the forward geocoding endpoint in some cases would return lat/lng as floats, ugh. This have been resolved now so they will always return as numbers.
Mathias
abtrout commented
Thanks 👍