JSON is a standard, text-based format for displaying structured data in a human-readable way. Its objects commonly hold key-value pairs, nested lists, and other subsets of information; Python represents these structures as dictionaries and lists. section 10.1.1
In an API workflow, convert the response to JSON, inspect its keys, locate the nested data of interest, and reshape that data into a tabular structure for analysis. Because each API has a unique response format, identifying the relevant path is part of the analyst’s work. section 10.1.1 section 10.4
Account for these practical considerations when working with JSON from APIs:
- Inspect nested objects and lists before selecting fields for a dataframe. section 10.1.1
- Expect additional processing when values contain nested documents, timestamps, or text such as wind-speed ranges. section 10.1.1
- Evaluate authentication, pagination, rate limits, automation resources, and whether returned data fits a centralized warehouse. section 10.4
Seven-day weather forecast
A request to a New York City weather API returns a JSON object with top-level keys including properties. The forecast periods nested inside properties contain repeated dictionaries; selecting fields such as endTime, temperature, and windSpeed allows them to become dataframe columns and later daily summaries. section 10.1.1
forecast = response.json() #1 print(forecast.keys()) #2
Inspect the converted response’s top-level keys before navigating into nested JSON data. section 10.1.1


































