currently i am trying to send an array of arrays containing integers to my rest api, this is part of my test:
res = self.client.post(
'/data',
{
'data': [
[1,2,3],
[4,5,6]
]
}
)
In my serializer i try to print the data:
def create(self, validated_data):
print(self.context['request'].data)
print(self.context['request'].data['data'])
But i just get:
<QueryDict: {'data': ['[1, 2, 3]', '[4, 5, 6]']}>
[4, 5, 6]
Expected:
{'data': [[1, 2, 3], [4, 5, 6]]}
[[1, 2, 3], [4, 5, 6]]
How can this be?
Did i send the wrong format or did i access the json the wrong way...?
Thanks and Greetings!
Aucun commentaire:
Enregistrer un commentaire