From: 7stud -- Date: 2007-11-24T10:48:33+09:00 Subject: Re: Parsing nested JSON data Marko Anastasov wrote: > Now, among the rest, I also want to access those "ruby", "json" and > "library" strings. > With the following code: > > @structs = JSON.parse(@json_stream) > > for i in 0...@structs.length > @struct_obj = @structs.fetch(i) > @struct_obj.each { |key, value| > if key == "t" > # get the value that 't' points to > end > } > end > > I get them all appended to each other without any whitespace, ie > "rubyjsonlibrary". > > How could I access them individually? > > Marko > for i in 0...@structs.length > @struct_obj = @structs.fetch(i) > @struct_obj.each { |key, value| > if key == "t" > # get the value that 't' points to #the value that t points to is stored in your 'value' variable value.each do |str| puts str end > end > } > end -- Posted via http://www.ruby-forum.com/.