I'm using AWS SES send\_templated\_email method.
It's using a parameter called TemplateData
TemplateData – An escaped JSON string that contains key-value pairs. The keys correspond to the variables in the template (for example, {{name}}). The values represent the content that replaces the variables in the email.

If I use it hard coded, like this:

```
TemplateData="""{\"quarter_num\":\"Q2\",
                  \"year\":\"2021\",
                }"""

```

This works

But if I want to use variables in that string, something like:

```
TemplateData="""{\"quarter_num\":\"{}\",
                  \"year\":\"{}\",
                    }""".format("Q2", "2021")

```

This won't work. I think it's an escaping problem but I can't figure out how to do it correctly.
This is the error message I got:

```
[ERROR] KeyError: '"quarter_num"'
Traceback (most recent call last):
  File "/var/task/email_reports.py", line 35, in email_users
    }""".format("Q2", "2021")

```

When I use the hard coded string, this works without any problem.