I've been searching around trying to find an answer to this question, and I can't seem to track it down. Maybe it's too late in the evening to figure the answer out, so I turn to the excellent readers here.
I have the following bit of JSON data that I am pulling out of a CouchDB record:
"{"description":"fdsafsa","order":"1","place":"22 Plainsman Rd, Mississauga, ON, Canada","lat":43.5969175,"lng":-79.7248744,"locationDate":"03/24/2010"},{"description":"sadfdsa","order":"2","place":"50 Dawnridge Trail, Brampton, ON, Canada","lat":43.7304774,"lng":-79.8055435,"locationDate":"03/26/2010"},"
This data is stored inside a Python dict under the key 'locations
' in a dict called 'my_plan
'. I want to covert this data from CouchDB into a Python dict so I can do the following in a Django template:
{% for location in my_plan.locations %}
<tr>
<td>{{ location.place }}</td>
<td>{{ location.locationDate }}</td>
</tr>
{% endfor %}
I've found lots of info on converting dicts to JSON, but nothing on going back the other way.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…