I\'m trying to iterate of a parsed JSON response from reddit\'s API.
I\'ve done some googling and seems others have had this issue but none of the solutions seem to
You're trying to iterate over data, which is a hash, not a list. You need to get the children array from your JSON object by data['data']['children']
require "net/http"
require "uri"
require "json"
uri = URI.parse("http://www.reddit.com/user/brain_poop/comments/.json")
response = Net::HTTP.get_response(uri)
data = JSON.parse(response.body)
data['data']['children'].each do |child|
puts child['data']['body']
end