Main Tutorials

cURL post JSON data on Windows

On Windows, the key to send JSON data is double-quotes like this


-d "{\"name\":\"Spring Forever\"}"

cURL to POST a JSON data


 curl -X POST localhost:8080/books
	-H "Content-type:application/json" 
	-d "{\"name\":\"Spring Forever\",\"author\":\"pivotal\"}"

References

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
5 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
RANA
3 years ago

Great. This solved my problem.

Brent
1 year ago

I appreciate your posts. Thank you!

Paulo H A
1 year ago

Muito obrigado!

Ahren Bader-Jarvis
3 years ago

Thank you! I couldn’t figure out why the same command worked on Linux and not on Windows. This was the simple solution I needed. 🙂

Vinícius
9 months ago

Thank you!
Obrigado!
Gracias!