You’ll have to handle your own pagination, but if you want to only return 10 results, then add a query param at the end of your endpoint “?count=10”. Then to handle current page, just append a query param of “&page=2” to the count param.
So for your example it would be “json=get_category_posts&category_id=2?count=10&page=1 where page param would be your paginated pages.