# Best Practices for Implementing JSON

**URL:** <https://discuss.jsonapi.org/t/best-practices-for-implementing-json/2991>\
**Category:** Uncategorized\
**Created:** [January 31, 2025, 4:39pm UTC](https://discuss.jsonapi.org/t/best-practices-for-implementing-json/2991 "2025-01-31T16:39:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![favohem](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@favohem](https://discuss.jsonapi.org/u/favohem)\
**Post date:** [January 31, 2025, 4:39pm UTC](https://discuss.jsonapi.org/t/best-practices-for-implementing-json/2991/1 "2025-01-31T16:39:35Z")

</div>

Hello

When working with large datasets; implementing efficient pagination is crucial for performance and usability. JSON:API provides guidelines for pagination, but there are multiple approaches, such as `page-based`, `offset-based`, and `cursor-based` pagination. What are the best practices for implementing pagination while maintaining compliance with JSON:API standards? 🙃

One challenge developers face is balancing performance with usability. For example, cursor-based pagination is more efficient for large datasets but can be complex to implement. On the other hand; offset-based pagination is simpler but may become slow with large data tables. How do you determine the best approach for your specific use case? 🤔 I have checked [https://jsonlint.com/mastering-json-format-](https://jsonlint.com/mastering-json-format) [Salesforce Developer](https://www.igmguru.com/salesforce/salesforce-developer-training) documentation guide for reference.

I’d love to hear insights from those; who have implemented pagination in JSON:API. What challenges did you encounter, and how did you resolve them? Are there recommended libraries / techniques that simplify pagination while ensuring consistency with JSON:API specifications? 🤔

Thank you ! 🙂

---

<div class="post-metadata">

**Author:** ![Unsteady9968](https://avatars.discourse-cdn.com/v4/letter/u/3e96dc/32.png) [@Unsteady9968](https://discuss.jsonapi.org/u/Unsteady9968)\
**Post date:** [February 5, 2025, 5:38pm UTC](https://discuss.jsonapi.org/t/best-practices-for-implementing-json/2991/2 "2025-02-05T17:38:44Z")

</div>

I’m one of those people who has only used the page[number] page[size] implementation and that is or was a thing our frontend developers hated. What I mean by hated is the links object with first, last, and so on values, so instead we added headers also to include a count of all records, current page, next page and so on.

On thing to take note of is that the json specifications are open to most kinds of pagination

 ![Screenshot_20250205_182442_Firefox](https://us1.discourse-cdn.com/flex016/uploads/jsonapi/original/1X/b7a884b7d68fbce0658ef3c208dad9d22903bac8.png)  
and if the implementation the team did (that i worked in) would have been done only with the json api specifications then we would probably had included a meta object in the links object like the discussion in [Pagination controls](https://discuss.jsonapi.org/t/pagination-controls/422).
