An edge case is an unusual, extreme, or boundary condition that exposes limitations or failures in a system or process. In data pipelines, treat it as a normal design concern rather than an exception to discover after deployment. section 4.2.2 section 2.0
When parsing API or JSON data, check for:
- Missing optional fields, varying key names, unexpectedly null parent objects, and empty nested objects. section 4.2.2
- List fields that are empty or return a different type than expected. section 4.2.2
- Incomplete event information, such as omitted outs, scores, runner advancement, or partial count data. section 9.3.1
- Generated code or schemas that fail against the actual schema or business context. section 2.0
Defensive nested-field extraction
Use chained .get() calls with fallback dictionaries before reading nested values: geo = user.get("address", {}).get("geo", {}); lat = geo.get("lat"); lng = geo.get("lng"). Build the output only when the required coordinates exist; otherwise store None. Test the parser against multiple records, inspect the JSON structure, and log failures before trusting the resulting DataFrame. section 4.2.2
import requests
import pandas as pd
url = "https://jsonplaceholder.typicode.com/users"
response = requests.get(url)
users = response.json()
data = []
for user in users:
geo = user.get("address", {}).get("geo", {})
lat = geo.get("lat")
lng = geo.get("lng")
geo_string = f"({lat}, {lng})" if lat and lng else None
data.append({
"Name": user.get("name"),
"Username": user.get("username"),
"Email": user.get("email"),
"Company": user.get("company", {}).get("name"),
"Catch Phrase": user.get("company", {}).get("catchPhrase"),
"City": user.get("address", {}).get("city"),
"Geo (lat, lng)": geo_string
})
df = pd.DataFrame(data)
display(df.head())
A complete Python example retrieves users, safely unpacks nested address and company fields, formats coordinates, and displays the resulting pandas DataFrame. section 4.2.2












