Bird
0
0

An API expects a JSON object with a details field containing another object. You send:

medium📝 Debug Q7 of 15
Rest API - Request and Response Format
An API expects a JSON object with a details field containing another object. You send:
{"details": "name: John, age: 30"}

What is the issue?
AMissing comma between name and age
BJSON is valid and no issue
CKeys inside details are not quoted
D"details" should be a nested JSON object, not a string
Step-by-Step Solution
Solution:
  1. Step 1: Understand expected nested object

    The API expects 'details' to be an object, but a string was sent instead.
  2. Step 2: Check JSON structure

    The string inside 'details' is not parsed as JSON; keys inside it are not recognized as JSON keys.
  3. Final Answer:

    "details" should be a nested JSON object, not a string -> Option D
  4. Quick Check:

    Nested objects must be JSON objects, not strings [OK]
Quick Trick: Send nested data as JSON objects, not strings [OK]
Common Mistakes:
  • Sending nested data as plain strings
  • Ignoring JSON structure inside fields
  • Assuming string format is parsed automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes