Loop array of hashes

Please how can i loop this to have all values of _id, contact, sent,
answer, repondant?

{
“result” : [
{
“_id” : null,
“contact” : 45684,
“sent” : 0,
“answer” : 0,
“repondant” : 0
},
{
“_id” : “vms”,
“contact” : 6340,
“sent” : 6340,
“answer” : 0,
“repondant” : 0
},
{
“_id” : “sms”,
“contact” : 27356,
“sent” : 41344,
“answer” : 0,
“repondant” : 0
}
],
“ok” : 1
}

Thank you very much

Might be you can use like this way the JSON

json = JSON.parse(value)
json[“result”].each do |item|
# do something end

On 16 Jun 2015 17:26, “Simon E.” [email protected] wrote:

        "answer" : 0,
        "_id" : "sms",

Thank you very much
Which bit don’t you know how to do? Access the result array, iterate the
array, access the individual elements, or print the values?

Colin


Posted via http://www.ruby-forum.com/.


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected]
To post to this group, send email to [email protected]
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/effbb0e610963e6d58151176875dae4b%40ruby-forum.com
.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs