It becomes array when sending Django nested dict to API [duplicate]
I sent the dict data with this in Python:
data = {
"test":{
"A":"Adata",
"B":"Bdata",
"C":"Cdata"
}
}
response = self.client.post("/api_patch/",data,follow=True)
then receive this as:
@api_view(["POST","GET"])
def api_patch(request):
print("request.data",request.data)
print("request.data type",type(request.data))
However this shows,
request.data <QueryDict: {'test': ['A', 'B', 'C']}>
request.data type <class 'django.http.request.QueryDict'>
Somehow A B C is treated as array.
Where am I wrong?