Nested Error Reporting in REST API
📖 Scenario: You are building a REST API that receives user data. Sometimes, the data has errors inside nested parts, like an address inside a user profile. You want to collect all errors, including those inside nested data, and send them back in a clear way.
🎯 Goal: Create a Python dictionary that represents nested error messages for a user profile API. Then, write code to extract and display these nested errors clearly.
📋 What You'll Learn
Create a nested dictionary called
errors with specific error messagesCreate a variable
error_count to count total errorsUse a nested
for loop to count all errors inside the nested dictionaryPrint the total number of errors found
💡 Why This Matters
🌍 Real World
APIs often receive complex data with nested parts. Reporting all errors clearly helps users fix their input quickly.
💼 Career
Backend developers and API designers need to handle nested error reporting to improve user experience and debugging.
Progress0 / 4 steps