'"detail": "JSON parse error - Extra data: line 1 column 9 (char 8)" in django rest framework post request
Here is my view
@api_view(["POST"])
def afficher_donnees_instantanees(request):
if request.method == "POST":
print(request.data)
deveui = request.data["deveui"]
donnees = Historique.objects.filter(infos_signal__machine=deveui, infos_signal__jour=datetime.today()).order_by("-id").first()
serializer = HistoriqueSerializer(donnees)
return Response(serializer.data)
else:
return Response({"echec": "echec"})
serializer.py
class HistoriqueSerializer(serializers.ModelSerializer):
class Meta:
model = Historique
fields = '__all__'
I want to display data from my Historique model in response to a POST request, but I get the message "JSON parse error - Extra data: line 1 column 9 (char 8)".
Knowing that the response code is 400. Where can this error come from please?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
