I am very new to Ruby array and hash manipulation.
How can I do this simple transformation?
array = [#<struct id=1, car='red'>, #<struct id=2, car='yellow'>, #<struct id=3, car='green'>]
desired output in json:
[{id : 1, car : 'red'} , {id:2, car :'yellow'} ,{id:3 , car: "green"}]
Does anyone have any hints?
1 Answer