Ruby Hash of arrays iteration

I’m new to Ruby and i have a problem.

I make a RestClient.get on an url and i make a JSON parse on it.

response= RestClient.get ‘www.example.com
response=JSON.parse(response)

response looks like this:
{“tag”=>[“one”, “two”, “three”], “name”=>“example”}

and i would like to have an array like this::
[example-one,example-two,…]

I can print all tags or names but not together, if someone can help me
:slight_smile:

h= {“tag”=>[“one”, “two”, “three”], “name”=>“example”}

name=h[‘name’]
res= h[‘tag’].map {|no| “#{name}-#{no}”}

p res
==> [“example-one”, “example-two”, “example-three”]