when returning a JSONResponse, which was added in Django 1.7. and is a wrapper around json.dumps. However, in this case it results in an error. I'm sure the data is correct and can be serialized to JSON through Python shell.
What is the right way to serialize the data to JSON?
from django.http import JsonResponse
from collections import OrderedDict
data = OrderedDict([('doc', '546546545'), ('order', '98745'), ('nothing', '0.0')])
return JsonResponse(data) # doesn't work, JSONRenderer().render(data) works
Results in this error:
<map object at 0x7fa3435f3048> is not JSON serializable
OrderedDict([('doc', '546546545'), ('order', '98745'), ('nothing', '0.0')])