Reputation: 467
Mandrill sends back JSON data to my web-hook and when converted to Ruby data structures it looks like the below:
{ "image.jpg" => { "name => "image.jpg", "type" => "image/jpeg", "content" => "", "base64" => true } }
They send this, when what I need is an Array of Hashes, ex:
[{ "name => "image.jpg", "type" => "image/jpeg", "content" => "", "base64" => true }]
How can the first set of data be converted to an array of hashes?
Upvotes: 1
Views: 679
Reputation: 316
Try setting the returned data to foo:
foo = { "image.jpg" => { "name" => "image.jpg", "type" => "image/jpeg", "content" => "", "base64" => true } }
Then do:
Array.wrap(foo["image.jpg"])
Also, you're missing a closing quote symbol after the first "name" key in your hash
Edit: You can just set it to foo then run:
foo.values
Upvotes: 2