add pagination to as_json