From: 7stud -- Date: 2007-11-24T16:05:15+09:00 Subject: Re: Parsing nested JSON data 7stud -- wrote: > There's no documentation anywhere, and after I installed > it, I couldn't even require it into a program without error. Look how easy it is with the json gem: require 'rubygems' require 'json' str = '[ {"u":"http://...html","d":"some title","t":["ruby"]}, {"u":"http://....org/","d":"another title","t":["ruby","json","library"]} ]' arr = JSON.parse(str) p arr puts target_hash = arr[1] target_hash.each do |key, val| if key == 't' val.each {|elmt| puts elmt} end end --output:-- [{"d"=>"some title", "t"=>["ruby"], "u"=>"http://...html"}, {"d"=>"another title", "t"=>["ruby", "json", "library"], "u"=>"http://....org/"}] ruby json library -- Posted via http://www.ruby-forum.com/.