I have the following code to create a string using Jinja
from jinja2 import Template
jT = Template('"text": {{text}}, "peripherals": {{peripherals}}')
params = {'text': 'some_text', 'peripherals': 'mouse'}
jT.render(**params)
The resulting output is:
'"text": some_text, "peripherals": mouse'
Is there a way to surround the substituted values inside quotes, like so:
'"text": "hello", "peripherals": "mouse"'
Besides editing the existing jinja and using {{text|tojson}}, is there a way/function in Python to automatically wrap every substituted value inside quotes?