mardi 12 septembre 2017

Convert hash keys into a hash in ruby

Please review below input and helps me to convert it into the below output

Input:

[{"Key1"=>1, "key3"=>1}, {"Key2"=>3, "Key4"=>0}, {"Key1"=>1, "Key4"=>1}, {"Key2"=>3, "key3"=>0}, {"Key1"=>3, "Ke5"=>0}]

Output:

[{"Key1"=>1}, {"Key2"=>1}, {"Key3"=>3}, {"Key4"=>0}, {"Key1"=>1}, {"Key4"=>1}, {"Key3"=>3}, {"Key2"=>0}, {"Key1"=>3}, {"Key5"=>0}]

Aucun commentaire:

Enregistrer un commentaire