Bird
0
0

You receive this JSON string from an API:

medium📝 Debug Q14 of 15
Rest API - Request and Response Format
You receive this JSON string from an API:
{"user": "Bob", "age": 25,}

What is wrong with this JSON?
ATrailing comma after the last item is invalid
BKeys must be numbers, not strings
CValues cannot be numbers
DMissing square brackets around the object
Step-by-Step Solution
Solution:
  1. Step 1: Check JSON syntax rules

    JSON objects cannot have a comma after the last key-value pair.
  2. Step 2: Identify the error in the string

    The comma after "age": 25 is invalid and causes a syntax error.
  3. Final Answer:

    Trailing comma after the last item is invalid -> Option A
  4. Quick Check:

    No trailing commas allowed in JSON objects [OK]
Quick Trick: No commas after last item in JSON objects [OK]
Common Mistakes:
MISTAKES
  • Thinking keys must be numbers
  • Believing numbers are invalid values
  • Adding brackets incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes