Display custom links above top level arrays using Jbuilder

I have a custom JSON response in which I display a collection of 15
posts along with related data like comments etc., as part of an API
call. I am displaying the entire collection using Jbuilder .

json.array!(@posts) do |post|

I want to display pagination links above the response of the 15 posts,
in order to get the next set of posts with the appropriate next set of
next page and prev page pagination links. In my abc.json.jbuilder file
if I try doing it as per the below code, I don’t get links to the next
and prev page as part of my json response.

json.pagination_links do

json.array!(@posts) do |post|

The only response, that I get is the array which has a collection of
posts. Which looks like below:-

I guess there is something that I might be missing. Can anybody please
suggest me any work arounds?