From: "Maksim D." Date: 2012-05-25T16:10:00+09:00 Subject: accessing data in a ruby array I have this array. I want to access the stuff in the hashes. i can loop through them all and get the individual hashes but i cannot access the data. products.each.do |product| product[1] #this gives me the hash #product[1].id and product[1][:id] does not work end How do i access the name and description and rateplans inside this structure. Thanks in advance! products => ["prod0", {"id"=>"4028e6963457a2a001345934b93633e4", "name"=>"Product 1", "description"=>"This is a cool product with 4 rate plans of different frequencies", "rate_plans"=>{"rp0"=>{"id"=>"4028e6963457a2a001345936b60d33fa", "name"=>"Quarterly Rate Plan", "description"=>"This is a Quarterly Rate Plan billed every quarter.", "uom"=>"Seat", "charges"=>{"rpc0"=>{"id"=>"4028e697343fffc20134593a0a242ebd", "uom"=>"Seat", "quantity"=>"5", "name"=>"New Component", "price"=>0, "charge_model"=>"Per Unit Pricing"}}, "quantifiable"=>true}, "rp1"=>{"id"=>"4028e697343fffc2013459355d232e61", "name"=>"Monthly Rate Plan", "description"=>"This is the Monthly Rate Plan which is the most basic plan", "uom"=>"Seat", "charges"=>{"rpc0"=>{"id"=>"4028e697343fffc20134593678b12e65", "uom"=>"Seat", "quantity"=>"5", "name"=>"New Component", "price"=>0, "charge_model"=>"Per Unit Pricing"}}, "quantifiable"=>true}, "rp2"=>{"id"=>"4028e697343fffc20134593a4b652ec4", "name"=>"Semi-Annual Rate Plan", "description"=>"This is a Semi-Annual Rate Plan billed every 6 months.", "uom"=>"Seat", "charges"=>{"rpc0"=>{"id"=>"4028e6963457a2a00134593ac09f3415", "uom"=>"Seat", "quantity"=>"5", "name"=>"New Component", "price"=>0, "charge_model"=>"Per Unit Pricing"}}, "quantifiable"=>true}, "rp3"=>{"id"=>"4028e697343fffc20134593b63272ecd", "name"=>"Annual Rate Plan", "description"=>"This is an Annual Rate Plan billed yearly", "uom"=>"Each", "charges"=>{"rpc0"=>{"id"=>"4028e6963457a2a00134593ba494343a", "uom"=>"Each", "quantity"=>"5", "name"=>"New Component", "price"=>0, "charge_model"=>"Per Unit Pricing"}}, "quantifiable"=>true}}}] -- Posted via http://www.ruby-forum.com/.