title: Rails: JSON Parsing a URL for later use
body: <p>I'm trying to accomplish something really easily but I could not solve it to my beginner level in rails. The question is how do you assign a JSON objects attribute to a rails object.. I'm trying to send a request to Google Map's URL with some parameters. Without JSON parsing it works just fine, however when I try to parse it, I receive many errors. The regular JSON response from Google when I query the URL ([http://maps.googleapis.com/maps/api/directions/json?origin=40.983204,29.0216549&destination=40.99160908659266,29.02334690093994&sensor=false][1]) is like down below;</p>
  
  <pre><code>{
    "routes" : [
      {
        "bounds" : {
          "southwest" : {
            "lat" : 40.98289,
            "lng" : 29.02054
          },
          "northeast" : {
            "lat" : 40.99148,
            "lng" : 29.02388
          }
        },
        "summary" : "Mühürdar Cd",
        "waypoint_order" : [],
        "legs" : [
          {
            "start_location" : {
              "lat" : 40.98322,
              "lng" : 29.02166
            },
            "distance" : {
              "text" : "1.3 km",
              "value" : 1324
            },
  </code></pre>
  
  <p>And goes on.</p>
  
  <p>The code I have to get the "summary" attribute is;</p>
  
  <pre><code>@request = Net::HTTP.get(URI.parse('http://maps.googleapis.com/maps/api/directions/json?origin=40.983204,29.0216549&amp;destination=40.99160908659266,29.02334690093994&amp;sensor=false'))
      @result=JSON.parse(@request)["routes"]["summary"]
  </code></pre>
  
  <p>I wanted to ask what would be the proper way for me to get the <b>summary</b> attribute from the response?</p>