TypeError: can't convert Net::HTTPOK into String

Chris picture Chris · Feb 19, 2012 · Viewed 7.7k times · Source

I'm using net/http and json to geocode an address using google's Geocoding API. Here is where the error is being thrown:

response = Net::HTTP.get_response(URI.parse(url))
result = JSON.parse(response)

The response is of class Net::HTTPOK, but I want to access the actual JSON response data (not just the status code).

Answer

Marc Talbot picture Marc Talbot · Feb 20, 2012