0

In Lambda function, I am returning output as below

output = {
            "statusCode": 200,
            "headers": {'Content-Type': 'application/json'},
            "body": json.dumps({'success': true})
        }
        #json.dumps('Email sent! Message ID:' + response['MessageId'])
        return output

and it returns following error message:

{
    "message": "Internal server error"
}

However if I change following line

json.dumps({'success': true})

to

json.dumps('Email sent! Message ID:' + response['MessageId'])

It works fine. I want to return a json back, what needs to be done?

1 Answer 1

1

I think python's Json Boolean value has to be either True or False (First letter capital).
Try json.dumps({'success': True})

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.