Intermediate Importing Data in Python
Hugo Bowne-Anderson
Data Scientist at DataCamp
JavaScript Object Notation
Real-time server-to-browser communication
Douglas Crockford
Human readable
{'Actors': 'Samuel L. Jackson, Julianna Margulies, Nathan Phillips,
Rachel Blanchard',
'Awards': '3 wins & 7 nominations.',
'Country': 'Germany, USA, Canada',
'Director': 'David R. Ellis',
'Genre': 'Action, Adventure, Crime',
'Language': 'English',
'Rated': 'R',
'Released': '18 Aug 2006',
'Runtime': '105 min',
'Title': 'Snakes on a Plane',
'Type': 'movie',
'Writer': 'John Heffernan (screenplay), Sebastian Gutierrez (screenplay),
David Dalessandro (story), John Heffernan (story)',
'Year': '2006',
'imdbID': 'tt0417148',
'imdbRating': '5.6',
'imdbVotes': '114,668'}
{'Actors': 'Samuel L. Jackson, Julianna Margulies, Nathan Phillips,
Rachel Blanchard',
'Awards': '3 wins & 7 nominations.',
'Country': 'Germany, USA, Canada',
'Director': 'David R. Ellis',
'Genre': 'Action, Adventure, Crime',
'Language': 'English',
'Rated': 'R',
'Released': '18 Aug 2006',
'Runtime': '105 min',
'Title': 'Snakes on a Plane', <--
'Type': 'movie',
'Writer': 'John Heffernan (screenplay), Sebastian Gutierrez (screenplay),
David Dalessandro (story), John Heffernan (story)',
'Year': '2006',
'imdbID': 'tt0417148',
'imdbRating': '5.6',
'imdbVotes': '114,668'}
{'Actors': 'Samuel L. Jackson, Julianna Margulies, Nathan Phillips,
Rachel Blanchard',
'Awards': '3 wins & 7 nominations.',
'Country': 'Germany, USA, Canada',
'Director': 'David R. Ellis',
'Genre': 'Action, Adventure, Crime',
'Language': 'English',
'Rated': 'R',
'Released': '18 Aug 2006',
'Runtime': '105 min',
'Title': 'Snakes on a Plane', <--
'Type': 'movie',
'Writer': 'John Heffernan (screenplay), Sebastian Gutierrez (screenplay),
David Dalessandro (story), John Heffernan (story)',
'Year': '2006', <--
'imdbID': 'tt0417148',
'imdbRating': '5.6',
'imdbVotes': '114,668'}
import json
with open('snakes.json', 'r') as json_file:
json_data = json.load(json_file)
type(json_data)
dict
for key, value in json_data.items():
print(key + ':', value)
Title: Snakes on a Plane
Country: Germany, USA, Canada
Response: True
Language: English
Awards: 3 wins & 7 nominations.
Year: 2006
Actors: Samuel L. Jackson, Julianna Margulies
Runtime: 105 min
Genre: Action, Adventure, Crime
imdbID: tt0417148
Director: David R. Ellis
imdbRating: 5.6
Rated: R
Released: 18 Aug 2006
Intermediate Importing Data in Python