Answer the question
In order to leave comments, you need to log in
How to properly parse Sypexgeo json in Rails?
Perhaps the question is very stupid. But I could not pull out only the city from json (name_ru).
How to do it right? Tried to do so
def location_city
@remote_ip = request.remote_ip
@result = Net::HTTP.get(URI.parse("http://api.sypexgeo.net/json/#{@remote_ip}"))
@city = ?
end
{
"ip":"123.45.67.89",
"city":{
...
"name_ru":"Сеул",
...
},
"region":{
...
},
"country":{
...
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question