Got Failed to decode JSON object when calling a POST request in flask python Got Failed to decode JSON object when calling a POST request in flask python flask flask

Got Failed to decode JSON object when calling a POST request in flask python


This works in Windows 7 64:

curl -i -H "Content-Type: application/json" -X POST -d "{\"title\":\"Read a book\"}" http://localhost:5000/todo/api/v1.0/tasks

Back slashes and double quotes.


If you are using windows your json string in your request should look like:

"{\"title\":\"Read a boo\"}"

I've got the same problem and it helped.


I Managed to get it working using Anaconda cmd window, python3, using backslashes and double quotes around the whole expression!Works:

curl "localhost:5000/txion" -H "Content-Type: application/json" -d "{\"from\": \"akjflw\" ,\"to\" : \"fjlakdj\", \"amount\": 4}"

Does not work:

curl "localhost:5000/txion" -H "Content-Type: application/json" -d '{\"from\": \"akjflw\" ,\"`to\" : \"fjlakdj\", \"amount\": 4}'