Bird
0
0

Which of the following is a correct JSON syntax for an error response with code 404 and message "Not Found"?

easy📝 Syntax Q3 of 15
Rest API - Request and Response Format
Which of the following is a correct JSON syntax for an error response with code 404 and message "Not Found"?
A{"error": {"code": 404, "message": "Not Found"}}
B{"error": {code: 404, message: "Not Found"}}
C{"error": {"code": "404", "message": Not Found}}
D{"error": {"code": 404, "message": Not Found}}
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

    {"error": {"code": 404, "message": "Not Found"}} uses correct quotes and syntax. Others miss quotes or have misplaced quotes.
  3. Final Answer:

    {"error": {"code": 404, "message": "Not Found"}} -> Option A
  4. Quick Check:

    Proper JSON syntax = {"error": {"code": 404, "message": "Not Found"}} [OK]
Quick Trick: Always use double quotes for keys and string values in JSON [OK]
Common Mistakes:
  • Omitting quotes around keys
  • Using single quotes instead of double quotes
  • Not quoting string values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes