Я не могу напечатать значения в главном каталоге, возвращенном из json.
Я хочу вернуть следующие поля в цикле
require 'httparty'
require 'rubygems'
response = HTTParty.get("https://www.instagram.com/p/BvNWyEpDoz2/?__a=1")
response['graphql']['shortcode_media'].each do |child|
puts child['__typename']
puts child['id']
puts child['display_url']
puts child['edge_media_to_parent_comment']['edges']
puts child['node']['text']
end
Traceback (most recent call last):
2: from apisample2.rb:7:in `<main>'
1: from apisample2.rb:7:in `each'
apisample2.rb:9:in `block in <main>': undefined method `[]' for nil:NilClass (NoMethodError)
Traceback (most recent call last):
3: from apisample2.rb:7:in `<main>'
2: from apisample2.rb:7:in `each'
1: from apisample2.rb:9:in `block in <main>'
apisample2.rb:9:in `[]': no implicit conversion of String into Integer (TypeError)