title: Convert JSON to string or hash in ruby
body: <p>I have tried:</p>
  
  <pre><code>require 'net/http'
  require 'json'
  require 'pp'
  require 'uri'
  
  url = "http://xyz.com"
  resp = Net::HTTP.get_response(URI.parse(url))
  buffer = resp.body
  result = JSON.parse(buffer)
  #result.to_hash
      #pp result
  puts result  
  </code></pre>
  
  <p>And got the output as:</p>
  
  <pre><code>{"id"=&gt;"ABC", "account_id"=&gt;"123", "first_name"=&gt; "PEUS" }
  </code></pre>
  
  <p>in JSON format but I only need the value of <code>id</code> to be printed as <code>ABC</code>. </p>