Bird
0
0

Which of the following is the correct JSON structure for a simple response envelope?

easy📝 Syntax Q12 of 15
Rest API - Request and Response Format
Which of the following is the correct JSON structure for a simple response envelope?
A{"status": "success", "data": {"id": 1, "name": "Alice"}}
B{"data": {"id": 1, "name": "Alice"}, "error": null}
C{"result": {"id": 1, "name": "Alice"}}
D{"message": "success", "payload": {"id": 1, "name": "Alice"}}
Step-by-Step Solution
Solution:
  1. Step 1: Identify the typical keys in a response envelope

    Common keys include "status" for success/failure and "data" for the actual content.
  2. Step 2: Check each option for correct keys and structure

    {"status": "success", "data": {"id": 1, "name": "Alice"}} uses "status" and "data" correctly. Others use different or missing keys.
  3. Final Answer:

    {"status": "success", "data": {"id": 1, "name": "Alice"}} -> Option A
  4. Quick Check:

    Correct keys = status + data [OK]
Quick Trick: Look for 'status' and 'data' keys in JSON [OK]
Common Mistakes:
  • Using 'result' or 'payload' instead of 'data'
  • Missing the 'status' key
  • Confusing 'error' with 'status'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes