json query logic with Paginator