5.5 Reading JSON Data from the Internet

As mentioned earlier, another popular format for making data available on the Internet is JSON (JavaScript Object Notation). Like CSV files, JSON embeds identifying fields with the data. Whereas CSV files provide data names at the top of the file, JSON provides the data names with each piece of data using a dictionary-like syntax.

To demonstrate the use of data in JSON format, let’s use the same earthquake data from the USGS. The USGS provides the earthquake data in GeoJSON format, which is designed for communicating geographic information. GeoJSON uses standard JSON formatting. The JSON data is provided under the Real-Time Feeds on the USGS website (https://earthquake.usgs.gov/earthquakes/).

We will examine ...

Get Python Programming in Context, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.