In a hobby project, I am using TwelveData API to receive Time Series Data. I am using JSON format response and able to check each data (example: open, close, high, and etc.) from Python side, but the problem arises when I try to show the data in a Django Template page using a for-loop. The JSON response is similar to below image:
When I write the following for loop in the template:
{%for r in result %}
{{r}}
{%endfor %}
It prints GOOGL, AAPL, AMZN, and TSLA <-- which is pretty good. Now when I write another for loop like:
{%for r in result %}
{%for k in result.r %}
{{k}}
{%endfor %}
{%endfor %}
It prints nothing except a blank page. So I rewrite the main for-loop as follows:
{%for r,v in result %}
{{v}}
{%endfor %}
It prints ValueError: Need 2 values to unpack in for loop; got 5.
Can anyone help me identify how to run the loop accurately so that I can get/print (maybe inside a table tag) the JSON response data as follows: open, close, high, and etc.
- Thanks