I need GET value from hash of hashes of Ruby on Rails
@result = {
"destination_addresses" => [
"Matucana 775, Santiago Centro, Región Metropolitana de Santiago de Chile, Chile"
],
"origin_addresses" => [
"San Pablo 6134, Lo Prado, Región Metropolitana de Santiago de Chile, Chile"
],
"rows" => [
{
"elements" => [
{
"distance" => {
"text" => "10,0 km",
"value" => 9957
},
"duration" => {
"text" => "15 min",
"value" => 903
},
"status"=>"OK"
}
]
}
],
"status"=>"OK"
}
@duration = @result["rows"]["elements"]["distance"]["value"]
@distance = @result["rows"]["elements"]["duration"]["value"]
This results in:
ERROR:
can't convert String into Integer