import re
from jinja2 import Template
template = '{"text": {{text}}, "peripherals": {{peripherals}}}'
# Use regular expressions to identify the variables
template = re.sub(r"({{)(w*)(}})", r'"123"', template)
jT = Template(template)
params = {'text': 'some_text', 'peripherals': 'mouse'}
print(jT.render(**params))