I'm just starting to argue about using the JSON web service, and I have a little problem when you can find a better way to get the actual data items.
I get an answer that has been converted to a Ruby hash using the JSON.parse method. The hash looks like this:
{"response"=>{"code"=>2002, "payload"=>{"topic"=>[{"name"=>"Topic Name", "url"=>"http://www.something.com/topic", "hero_image"=>{"image_id"=>"05rfbwV0Nggp8", "hero_image_id"=>"0d600BZ7MZgLJ", "hero_image_url"=>"http://img.something.com/imageserve/0d600BZ7MZgLJ/60x60.jpg"}, "type"=>"PERSON", "search_score"=>10.0, "topic_id"=>"0eG10W4e3Aapo"}]}, "message"=>"Success"}}
What I would like to know is the easiest way to get the "topic" data so that I can do something like:
topic.name = json_resp.name topic.img = jsob_resp.hero_image_url etc
Leddo source share