I need to use data as JSON from an API in Django View here is my JSON data;
[{'Count': 5491}]
I need to pass just value of the "Count" key to HTML and views.py is as below;
def serviceReport(request):
data = mb.post('/api/card/423/query/json')
context = {
'count' : data['Count']
}
return render(request, 'service_report.html', context)
I get error like this;
Exception Type: TypeError
Exception Value:
list indices must be integers or slices, not str
What I want is to pass value of count key to service_report.html and also I want to pass multiple JSON datas like data2, data3 as data on views.py how can I do it?