Solution for Python TypeError: Object of type Response is not JSON serializable

I have an API Gateway that trigger a Lambda function which return a python dictionary. For example:

    return {
        "statusCode": 200,
        "body": json.dumps({
            "result path": result path ,
        }),
    }        

However, I found the following error at API Gateway Log:

Lambda execution failed with status 200 due to customer function error: Object of type set is not JSON serializable. Lambda request id: xxxxxx         

Solution :

response=response.json()        

To view or add a comment, sign in

More articles by Wesley Siow

Insights from the community

Others also viewed

Explore topics