Bird
Raised Fist0

Given this error response JSON, what is the message for the username field?

medium📝 Predict Output Q4 of Q15
Rest API - Error Handling

Given this error response JSON, what is the message for the username field?

{
  "errors": {
    "username": {
      "length": "Too short",
      "characters": "Invalid symbols"
    },
    "email": "Missing"
  }
}

A"Invalid symbols" only
B"Too short" and "Invalid symbols"
C"Too short" only
D"Missing"
Step-by-Step Solution
Solution:
  1. Step 1: Locate the username field in the JSON

    The username field contains an object with two messages: "length" and "characters".
  2. Step 2: Combine the messages for username

    Both "Too short" and "Invalid symbols" describe username errors nested inside.
  3. Final Answer:

    "Too short" and "Invalid symbols" -> Option B
  4. Quick Check:

    Username errors = Both nested messages [OK]
Quick Trick: Nested errors combine all messages under a field [OK]
Common Mistakes:
MISTAKES
  • Picking only one nested message
  • Confusing email error with username
  • Ignoring nested structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes