title: How to get a second level field from json file using ruby
body: <p>I'm work with json gem in ruby. Im trying to print second level field such as [address/city/born_in].My ruby code is</p>
  
  <pre><code>json = File.read('person.json')
  person = JSON.parse(json)
  pp person
  puts person["address"]["city"]["born_in"]
  </code></pre>
  
  <p>My json file as follows..,</p>
  
  <p>{
     "FirstName":"John",
     "lastName":"Smith",
     "age":25,
     "address":[
        {
           "streetAddress":"21 2nd Street",
           "state":"NY",
           "postalCode":"10021"
        },
        {
           "city":{
              "born_in":"New York",
              "living_in":"Mumbai"
           }
        }
     ]
  }</p>
  
  <p>It shows the following error..,</p>
  
  <pre><code>parsingjson.rb:15:in `[]': can't convert String into Integer (TypeError)
          from parsingjson.rb:15:in `&lt;main&gt;'
  </code></pre>