Skip to main content

Hello,

Our template tag {{ item.ItemOptions }} is showing as:

{'Color': 'Assorted', 'Color_Choices': 'Green, Red, Blue, Yellow, Pink', 'Text_Field': 'Text Field', 'Text_Area': 'Text Area', 'File_Upload': 'Features Needed.txt ', 'Select_Dropdown': 'Select Dropdown 1', 'Select_Radio': 'Select Radio 1', 'Select_Checkbox': 'Select Checkbox 1, Select Checkbox 2, Select Checkbox 3', 'Multiple_Select': 'Multiple Select 1, Multiple Select 2, Multiple Select 3'}

How can I format the output as HTML like:

Color: Assorted
Color_choices: Green, Red, Blue, Yellow, Pink
Text_Field: Text Field
etc.....

Thanks for any help!

 

So apparently it is outputting an OBJECT not JSON, my apologies I’m new 😁

 

I tried:

{% for obj in item.ItemOptions %}
    <p>{{ obj }}</p>
{% endfor %}

 

But it’s only showing:

Color
Color_choices
Text_Field

 

And not:

Color: Assorted
Color_choices: Green, Red, Blue, Yellow, Pink
Text_Field: Text Field


Finally figured it out. In case anyone else might find this useful, I used:

{% for k, v in item.ItemOptions.items %}
  {{ k }}: {{ v }}
{% endfor %}


Hi @stevekem

 

Thank you so much for sharing your your solution with the Community! I know it will definitely help someone else in the future who is also experiencing this issue!

 

Thanks for participating in our Community and helping others!

-Taylor 


Reply