Search code examples
djangojsonresponse

JsonResponse to array


I use a django library function.

my_data = get_stats(request)

get_stats returns JsonResponse.

return JsonResponse({'data': response})

Every response object consists of 'id', 'name' and 'value'. I need to parse my_data to array - I need to get every item's id, name and value. How can I do this?


Solution

  • JsonResponse body is in my_data.content So rightful is

    json.loads(my_data.content)