Error when trying to add array element to hash - RUBY
-
Hi all, I have a small program that makes a call to a REST API and retrieves a block of JSON. I am parsing this in Ruby which then creates a hash. Because of the way the JSON is structured I am putting the hash into an array and then extracting the second element. I am then doing some string manipulation on this element to produce another array with each element containing a string that looks like the following:-
{:from=>"2018-01-01T00:00Z", :to=>"2018-01-01T00:30Z", :intensity=>{:forecast=>154, :actual=>157, :index=>"low"}}
I am then trying to put each of these elements back into a hash and back into an array (so I end up with an array of hashes) so I can get access to each element of the hash through their corresponding keys. However when I try to do this within the 'each do end' loop I get an error:-
odd number of arguments for Hash
When I take the same string and just directly add it to the hash (like indicated below) it works fine:-
hash["Mystring"]
Any idea what else I can try? I can post more code if that would help. Thanks D