Rest API - Request and Response FormatWhich of these is the correct JSON format for a consistent REST API response containing a user's name and age?A{"name": "Alice", "age": 30}B{"Name": "Alice", "Age": "30"}C{"user_name": "Alice", "user_age": 30}D["Alice", 30]Check Answer
Step-by-Step SolutionSolution:Step 1: Check for consistent key naming and data types{"name": "Alice", "age": 30} uses lowercase keys and age as a number, which is common and consistent.Step 2: Compare other options for consistency{"Name": "Alice", "Age": "30"} uses uppercase keys and age as string, inconsistent with typical API standards.Final Answer:{"name": "Alice", "age": 30} -> Option AQuick Check:Consistent keys and types = {"name": "Alice", "age": 30} [OK]Quick Trick: Use lowercase keys and correct data types in JSON [OK]Common Mistakes:Using inconsistent key casingRepresenting numbers as stringsUsing arrays instead of objects for key-value data
Master "Request and Response Format" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - Why HTTP methods define intent - Quiz 15hard HTTP Methods - PATCH for partial updates - Quiz 10hard HTTP Methods - PUT for full replacement - Quiz 1easy HTTP Status Codes - 429 Too Many Requests - Quiz 3easy HTTP Status Codes - 204 No Content - Quiz 15hard Query Parameters and Filtering - Filtering by field values - Quiz 14medium Query Parameters and Filtering - Sort direction (asc, desc) - Quiz 13medium REST API Fundamentals - Statelessness requirement - Quiz 8hard Request and Response Format - JSON as standard format - Quiz 6medium Request and Response Format - Response headers (Cache-Control, ETag) - Quiz 2easy