Skip to content

Instantly share code, notes, and snippets.

@wannabefro
Created February 28, 2014 21:07
Show Gist options
  • Save wannabefro/9279948 to your computer and use it in GitHub Desktop.
Save wannabefro/9279948 to your computer and use it in GitHub Desktop.
require 'json'
require 'pry'
data = JSON.parse(IO.read('movies_data.json'))
# cast_members = data['movies'][0]['abridged_cast']
# cast_member_names = cast_members.map{|member| member['name']}
all_cast_members = []
all_cast_characters = []
movies = data['movies']
movies.each do |movie|
# puts "The movie is #{movie['title']}"
movie['abridged_cast'].each do |member|
# puts "The actor/ress is #{member['name']}"
all_cast_members << member['name']
end
end
# puts all_cast_members
# movies.each{|movie| puts movie['title']}
movies.each do |movie|
# puts "The movie is #{movie['title']}"
movie['abridged_cast'].each do |member|
if member['name'] == 'Eva Green'
puts "Eva Green stars in #{movie['title']}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment