Ruby on Rails Tuesday, June 16, 2015

Might be you can use like this way the JSON

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


On Tuesday, 16 June 2015 20:26:33 UTC+4, Ruby-Forum.com User wrote:
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

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/73bf2ed2-e12e-4e4a-8660-06050bf6bf81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment