From: "Abinoam Jr." Date: 2011-01-18T14:23:14+09:00 Subject: Re: Add value inside 'Nested Mappings String' In your example, there's only one element in the Array, and 4 elements in the inner Hash. Step-by-step... 1) Returns an Array. a["System"]["H&S"]["children"] #=> [{"name"=>"Training and Culture", "type"=>"Objective", "subtype"=>"None", "components"=>"None"}] 2) Returns the first element of the Array. It's the Hash you're trying to manipulate. a["System"]["H&S"]["children"][0] # => {"name"=>"Training and Culture", "type"=>"Objective", "subtype"=>"None", "components"=>"None"} 3) Now that you have the Hash, you can access its pairs (key,value). a["System"]["H&S"]["children"][0]["type"] #=> "Programme" 4) Or, set it... a["System"]["H&S"]["children"][0]["type"] = "Objective" Abinoam Jr. On Mon, Jan 17, 2011 at 10:50 PM, Kamarulnizam Rahim wrote: > Hi Abinoam, > > I tried to change the children type from "programme" to "objective" by > using the following code: > > a["System"]["H&S"]["children"][1]["type"]="Objective" > > but error came out. I used '1' as i thought that hash is the second > element of an array (based on your previous post). Thanks > > Nizam > > -- > Posted via http://www.ruby-forum.com/. > >