Nested Hash Problem

Dear all,
I have a hash
serv_value => {60=>{“servicetype_id”=>4, “quantity”=>1, “amount”=>360.0,
“narration”=>“GTT”}, 6116=>{“servicetype_id”=>1934, “quantity”=>1,
“amount”=>42500.0, “narration”=>“HRT.BT SHUNT”},
78=>{“servicetype_id”=>5499, “quantity”=>1, “amount”=>500.0,
“narration”=>“LIPID PROFILE”}, 6477=>{“servicetype_id”=>5499,
“quantity”=>1, “amount”=>500.0, “narration”=>“XRAY CHARGES”},
152=>{“servicetype_id”=>5499, “quantity”=>1, “amount”=>90.0,

I want it to rearrange such a way that I should get

serv_value => {4 => {“quantity”=>1, “amount”=>360.0,
“narration”=>“GTT”}, 1934=>{“quantity”=>1, “amount”=>42500.0,
“narration”=>“HRT.BT SHUNT”}, 5499 => {{ “quantity”=>1, “amount”=>500.0,
“narration”=>“LIPID PROFILE”}, {“quantity”=>1, “amount”=>500.0,
“narration”=>“XRAY CHARGES”}, {“quantity”=>1, “amount”=>90.0,
“narration”=>“VDRL”}} }

In this, I need to make a hash with key as servicetype_id.

Pls help me,
Thanks in Advance,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs