Type an API Response Safely
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- hard
- Pro
Your app fetches a list of products from a third-party API. The current code parses the JSON and casts it to an array of products. One day the API starts returning prices as strings, and the app shows wrong totals without any error. Explain why the types didn't catch this, and how you'd make the boundary safe so bad data is caught where it enters the app.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.