title: Object of type 'InlineKeyboardButton' is not JSON serializable
body: <p>my code is here</p>
  <pre><code>def forwards(update:Update, context:CallbackContext):
      query = update.callback_query
      next_index = int(query.data.split(&quot;_&quot;)[1]) + 1
      current_index = int(query.data.split(&quot;_&quot;)[1])
      html = &quot;&quot;
  
     # if context.user_data[&quot;totalPage&quot;] == current_index:
      for i in range(((current_index - 1)*20), context.user_data[&quot;rows&quot;]):
          html += context.user_data[&quot;videos&quot;][i]
      c_d = current_index - 1
      button = [[InlineKeyboardButton(&quot;⬅️previous page&quot;, callback_data=&quot;minus_&quot; + str(c_d))]]
      markup = InlineKeyboardButton(button)
      a = query.edit_message_text(text = html, parse_mode = ParseMode.HTML, reply_markup = markup) 
  
  
  def message_handle(update, context:CallbackContext):
      temp = r.message_handler(update.message)
      context.user_data[&quot;videos&quot;] = temp[&quot;videos&quot;]
      context.user_data[&quot;totalPage&quot;] = temp[&quot;totalPage&quot;]
      context.user_data[&quot;rows&quot;] = temp[&quot;rows&quot;]
      html = &quot;&quot;
      
      if temp[&quot;rows&quot;] &gt;= 20:
          count = 0
          for i in temp[&quot;videos&quot;]:
              if count == 20:
                  break
              html += i
              count += 1
      elif temp[&quot;rows&quot;] &lt; 20:
          for i in temp[&quot;videos&quot;]:
              html += i
          
      button = [[InlineKeyboardButton(&quot;next page➡️&quot;, callback_data=&quot;plus_2&quot;)]]
      markup = InlineKeyboardMarkup(button)
      
      update.message.reply_text(text = html , parse_mode = ParseMode.HTML, 
                                  disable_web_page_preview = True, 
                                  reply_to_message_id = update.message.message_id,
                                  reply_markup = markup)
  </code></pre>
  <p>when cliecnt sends a keyword to the bot, the bot ,using the keyword, finds out relevant data in the other file, txtfile.
  It will forward reply message to the client page by page , using callbackquery .</p>
  <p>there are 3 function,</p>
  <ol>
  <li>def message_handle (that's for MessageHandler)</li>
  </ol>
  <p>2.def forwards ( thats for callbackQuery handler, as the name said for forward page after &quot;forward&quot;( callback_data &quot;plus&quot; )button click)</p>
  <ol start="3">
  <li>def backwards ( for callbackQuery handler, as the name said for backward page after &quot;backward&quot;(callback data &quot;minus&quot;) button click)</li>
  </ol>
  <p>um...
  the message_handle shows (in function message_handle) fine..
  but there is error showed after the inline button(forward) click..</p>
  <pre><code>TypeError: Object of type 'InlineKeyboardButton' is not JSON serializable
  </code></pre>
  <p>and the following is the main part</p>
  <pre><code>def main():
      dp.add_handler(MessageHandler(Filters.text, message_handle))
      dp.add_handler(CallbackQueryHandler(forwards, pattern = &quot;plus&quot;))
      dp.add_handler(CallbackQueryHandler(backwards, pattern = &quot;minus&quot;))
      
      updater.start_polling()
      updater.idle()
  </code></pre>
  <p>so whats wrong of it..?
  thanks for you attention</p>