Created
December 1, 2015 20:55
-
-
Save xet7/b6a0cb9e12903e362e84 to your computer and use it in GitHub Desktop.
Converting ruby hash to another. Mainly to get Datavalues to destination places.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: | |
{"Level1"=> | |
[{"Level2"=> | |
[{"Level3"=>[{"Data1name"=>["Data1value"]}], | |
"Info1"=> | |
[{"Data4name"=>["Data4value"], | |
"Data3name"=>["Data3value"], | |
"Data5name"=>["Data5value"], | |
"Info2"=> | |
[{"Data2name"=>"Data2value1", "content"=>"Data2value2"}]}]}]}]} | |
Destination: | |
{"auth_token"=>"something", | |
"items"=> | |
[{"label"=>"Name1", "value"=>"Data1value"}, | |
{"label"=>"Name2", "value"=>"Data2value1+Data2value2"}, | |
{"label"=>"Name3", "value"=>"Data3value"}, | |
{"label"=>"Name4", "value"=>"Data4value"}, | |
{"label"=>"Name5", "value"=>"Data5value"}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment