Flask RESTful POST JSON fails Flask RESTful POST JSON fails flask flask

Flask RESTful POST JSON fails


-d '{"Hello":"Karl"}' doesn't work from windows as its surrounded by single quotes. Use double quotes around and it will work for you.

-d "{\"Hello\":\"Karl\"}"


I just want to point out that you need to escape regardless of OS - and regardless if you have double quotes around the request data - I saw this post and didn't think it was the answer to my issue because I had double quotes around the request data and single quotes inside:

This won't work:

-d "{'Hello': 'Karl'}"

This will:

-d "{\"Hello\":\"Karl\"}"

Again, you need to escape the quotes regardless of OS (I'm on Mac) and regardless of whether you have single or double quotes

And thanks Sabuj Hassan for your answer!


To add-on to the previous two answers, you do not need to escape the quotes across all OS's, following this syntax will work just fine on Mac/Linux:

-d '{"Hello":"Karl"}'