Bird
0
0

Which of the following is the correct JSON structure for pagination metadata in a REST API response?

easy📝 Syntax Q12 of 15
Rest API - Pagination Patterns

Which of the following is the correct JSON structure for pagination metadata in a REST API response?

{
  "data": [...],
  "pagination": {
    "current_page": 1,
    "total_pages": 5,
    "per_page": 10
  }
}
A{ "pagination": "page 1 of 5" }
B{ "page": 1, "pages": 5, "size": 10 }
C{ "pagination": [1, 5, 10] }
D{ "pagination": { "current_page": 1, "total_pages": 5, "per_page": 10 } }
Step-by-Step Solution
Solution:
  1. Step 1: Check JSON structure for pagination metadata

    The correct structure uses a nested object with keys like current_page, total_pages, and per_page to clearly describe pagination details.
  2. Step 2: Compare options to the example

    { "pagination": { "current_page": 1, "total_pages": 5, "per_page": 10 } } matches the example with a nested object and descriptive keys, while others use incorrect formats or data types.
  3. Final Answer:

    { "pagination": { "current_page": 1, "total_pages": 5, "per_page": 10 } } -> Option D
  4. Quick Check:

    Pagination metadata = nested object with page info [OK]
Quick Trick: Look for nested object with clear keys for pagination [OK]
Common Mistakes:
  • Using arrays instead of objects for metadata
  • Using strings instead of structured data
  • Omitting descriptive keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes