Bird
0
0

A developer sends this validation error response:

medium📝 Debug Q7 of 15
Rest API - Error Handling
A developer sends this validation error response:
{"errors": {"email": "Invalid format", "email": "Required field"}}

What is the problem with this JSON?
ADuplicate keys cause only one error to appear
BThe error messages are too long
CThe JSON is missing a root object
DThe HTTP status code is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Identify duplicate keys in JSON

    The 'email' key appears twice, which is invalid in JSON objects.
  2. Step 2: Understand JSON behavior with duplicates

    Only the last 'email' key value will be kept, so one error is lost.
  3. Final Answer:

    Duplicate keys cause only one error to appear -> Option A
  4. Quick Check:

    Duplicate JSON keys overwrite previous values [OK]
Quick Trick: JSON keys must be unique; duplicates overwrite [OK]
Common Mistakes:
  • Assuming JSON allows duplicate keys
  • Ignoring lost error messages
  • Blaming HTTP status instead of JSON structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes