Bird
0
0

Which of the following is the correct JSON snippet for pagination metadata showing page 2 of 5?

easy📝 Syntax Q3 of 15
Rest API - Pagination Patterns

Which of the following is the correct JSON snippet for pagination metadata showing page 2 of 5?

{
  "pagination": {
    "current_page": 2,
    "total_pages": 5
  }
}
A{ "pagination": { "page_number": 3, "total_pages": 5 } }
B{ "pagination": { "page": 5, "total": 2 } }
C{ "pagination": { "current": 5, "pages": 2 } }
D{ "pagination": { "current_page": 2, "total_pages": 5 } }
Step-by-Step Solution
Solution:
  1. Step 1: Check the keys and values for correctness

    { "pagination": { "current_page": 2, "total_pages": 5 } } uses correct keys current_page and total_pages with correct values 2 and 5.
  2. Step 2: Verify other options for errors

    Options B and C swap values or use incorrect keys; D has wrong current page number.
  3. Final Answer:

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

    Correct keys and values = { "pagination": { "current_page": 2, "total_pages": 5 } } [OK]
Quick Trick: Use 'current_page' and 'total_pages' keys for pagination [OK]
Common Mistakes:
  • Swapping current page and total pages values
  • Using incorrect key names like 'page' or 'pages'
  • Setting wrong current page number

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes