Bird
0
0

Which JSON snippet correctly shows nested error reporting for a REST API?

easy📝 Syntax Q3 of 15
Rest API - Error Handling

Which JSON snippet correctly shows nested error reporting for a REST API?

{
  "errors": {
    "email": "Invalid format",
    "password": {
      "length": "Too short",
      "complexity": "Missing special character"
    }
  }
}
AThe JSON uses XML tags instead of JSON format
BThe JSON uses a flat list of error strings without nesting
CThe JSON has errors as a single string message
DThe JSON nests errors under fields like password with multiple messages
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the JSON structure

    The JSON shows "password" error as an object with multiple nested messages, which is nested error reporting.
  2. Step 2: Compare with other options

    Other options describe flat lists, XML, or single strings, which do not match the nested structure shown.
  3. Final Answer:

    The JSON nests errors under fields like password with multiple messages -> Option D
  4. Quick Check:

    Nested error JSON = Nested objects under fields [OK]
Quick Trick: Nested errors use objects inside error fields [OK]
Common Mistakes:
  • Confusing flat error lists with nested errors
  • Mixing JSON with XML format
  • Using single string for multiple errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes