2

Below is what I would like to input as my testing event and is what my lambda python function knows how to process.

{
  "body": '{"email":"[email protected]","password":"Example1"}',
  "path": "/SignIn"
}

However, you can't configure this as a testing event in aws lambda because you get the following–somewhat justified–error:

There is an error in your JSON event. Please correct it before saving.

It is somewhat justified because there shouldn't be any single quotes in JSON. However, it won't work if I use all double quotes either.

Any ideas? Loopholes?

3
  • 1
    JSON strings must use the double-quote as the delimiter. Is the value associated with "body" supposed to be a string, or a nested object? Commented Sep 20, 2018 at 14:25
  • 1
    If it has to be string, then try "{\"email\":\"[email protected]\",\"password\":\"Example1\"}". Otherwise, just get rid of the single quotes. Commented Sep 20, 2018 at 14:31
  • Excellent! Thank you @PM2Ring, that is exactly what I needed! Commented Sep 20, 2018 at 15:25

1 Answer 1

1

You can do something like this

{
  "body": "{\"email\":\"[email protected]\",\"password\":\"Example1\"}",
  "path": "SignIn"
}

But then do json.loads() and get rid of the "", but ideally I will never send a password on API payload like this!

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.