code: def to_json_payload(self, data_rows):
          
          num_rows = len(data_rows)
          num_page = self.num_page
          num_rows_page = self.num_rows_page
  
          pages = num_rows / num_rows_page
          pages += divmod(num_rows, num_rows_page)[1] and 1 or 0
          start = (num_page - 1) * num_rows_page
          end = num_page * num_rows_page
          payload = {"page": num_page,
                     "total": pages,
                     "records": num_rows,
                     "rows": data_rows[start:end]}
          return json.dumps(payload)
docs: Returns the json payload