title: Object of type 'Decimal' is not JSON serializable
body: <blockquote>
  <p>Lambda execution failed with status 200 due to customer function error: Object of type 'Decimal' is not JSON serializable</p>
  </blockquote>
  <p>I went through all the existing solutions in the following link but nothing worked for me. What am I doing wrong?:
  <a href="https://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object">Python JSON serialize a Decimal object</a></p>
  <pre><code>import json
  import boto3
  import decimal
  
  
  client = boto3.resource('dynamodb')
  table = client.Table('table')
  
  def lambda_handler(event, context):
      method = event[&quot;httpMethod&quot;]
      print(event)
      if method==&quot;POST&quot;:
          return POST(event)
      elif method==&quot;DELETE&quot;:
          return DELETE(event)
      elif method==&quot;GET&quot;:
          return GET(event)
  
  #the respons format
  def send_respons(responseBody, statusCode):
      response = {
          &quot;statusCode&quot;: statusCode,
          &quot;headers&quot;: {
              &quot;my_header&quot;: &quot;my_value&quot;
          },
          &quot;body&quot;: json.dumps(responseBody),
          &quot;isBase64Encoded&quot;: 'false'
      }
      return response
      
  
  def GET(event):
      tab = table.scan()['Items']
      ids = []
              for item in tab:
                      ids.append({&quot;id&quot;:item[&quot;id&quot;], &quot;decimalOBJ&quot;:decimal.Decimal(item[&quot;decimalOBJ&quot;]}))
              return send_respons(ids, 201)
  </code></pre>