Bird
0
0

Which of the following is the correct JSON structure for sending a user's name and age in the request body?

easy📝 Syntax Q3 of 15
Rest API - Request and Response Format
Which of the following is the correct JSON structure for sending a user's name and age in the request body?
A{"name": "John", age: 25}
B{"name": John, "age": 25}
C{"name": "John", "age": 25}
D{name: "John", "age": 25}
Step-by-Step Solution
Solution:
  1. Step 1: Check JSON syntax rules

    Keys and string values must be in double quotes. Numbers do not need quotes.
  2. Step 2: Validate each option

    {"name": "John", "age": 25} correctly quotes keys and string values. Options A, B, and D miss quotes around keys or string values.
  3. Final Answer:

    {"name": "John", "age": 25} -> Option C
  4. Quick Check:

    JSON keys and strings need double quotes [OK]
Quick Trick: Always quote keys and string values in JSON [OK]
Common Mistakes:
MISTAKES
  • Missing quotes around keys or strings
  • Using single quotes instead of double quotes
  • Quoting numbers unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes