Substitua o valor do modelo Jinja dentro do dicionário Python

import re
from jinja2 import Template

template = '{"text": {{text}}, "peripherals": {{peripherals}}}'
# Use regular expressions to identify the variables
template = re.sub(r"({{)(\w*)(}})", r'"\1\2\3"', template)

jT = Template(template)

params = {'text': 'some_text', 'peripherals': 'mouse'}
print(jT.render(**params))
Adorable Armadillo