Aug 24, 20213:43 AM - edited Aug 24, 20213:43 AM
Participant
Updating key and value in a dict with variables
SOLVE
Hi everyone,
I am trying to update a dict variable with both key and value through variables. While the value variable works, the key variable just prints the variable name instead of the variable content.
{% set test_key = 'Key-Name' %}
{% set test_value = 'Value-string' %}
{% set test_object = {} %}
{% do test_object.update ({ "{{ test_key }}" : test_value }) %}
{{ test_object }}
I also tried:
{% do test_object.update ({ '{{ test_key }}' : test_value }) %}
{% do test_object.update ({ test_key : test_value }) %}