Python 如何解析json数据并将其加载到django模板

Python 如何解析json数据并将其加载到django模板,python,json,django,api,parsing,Python,Json,Django,Api,Parsing,我如何解析它以将存储地址id和标题从api加载到select选项值 到目前为止我都试过了 <select> {% for store in stores.store_address %} <option value="{{ store.store_address.id}}">{{ store.store_address.title}}</option> {% endfor %} </

我如何解析它以将存储地址id和标题从api加载到select选项值

到目前为止我都试过了

<select>
          {% for store in stores.store_address %}
          <option value="{{ store.store_address.id}}">{{ store.store_address.title}}</option>
          {% endfor %}
      </select>
URL:(json数据)

模板:

<select>
          {% for store in stores.store_address %}
          <option value="{{ store.store_address.id}}">{{ store.store_address.title}}</option>
          {% endfor %}
      </select>

{stores.store_address%}
{{store.store_address.title}
{%endfor%}

将模板更改为

演示:

<select>
    {% for store in stores %}
        {% for store_addres in stores.store_address %}
            <option value="{{ store_addres.id}}">{{ store_addres.title}}</option>
        {% endfor %}
    {% endfor %}
</select>

{%用于存储区中的存储区%}
{存储区中的存储区地址为%。存储区地址为%}
{{store_addres.title}
{%endfor%}
{%endfor%}
注意:

<select>
    {% for store in stores %}
        {% for store_addres in stores.store_address %}
            <option value="{{ store_addres.id}}">{{ store_addres.title}}</option>
        {% endfor %}
    {% endfor %}
</select>
  • stores
    是一个列表,您需要迭代它,然后访问
    store\u address

您是否尝试检查json链接@Rakesh,仍然存在问题