I have three arrays:
c = ["1", "2", "3"]
d = [["x1","x2","x3"],["x4","x5","x6"], ["x7","x8","x9"]]
e = [["20","21","22"], ["23","24","25"], ["26","27","28"]]
And I want to merge them together in Ruby to get this JSON result:
[
{"1":{
"x1":"20",
"x2":"21",
"x3":"22"
},
{
"x4":"23",
"x5":"24",
"x6":"25"
},
{
"x7":"26",
"x8":"27",
"x9":"28"
},
}
]
x1,x2,x3? they seem like variables. Do you want their names in output hash? That seems impossible to do. May be you need to look at your problem differently"2"and"3"inc? Are then insignificant/ignored? If they're significant then how are you expecting them to be used? Your selected answer doesn't match your desired output at this point.