Why do I get a malformed JSON in request body in this cURL call? Why do I get a malformed JSON in request body in this cURL call? json json

Why do I get a malformed JSON in request body in this cURL call?


I found the answer in the blog post: "Expecting to find valid JSON in request body..." curl for Windows.

For example, for Purge everything --data value will be:

# On Linux--data '{"purge_everything":true}'# On Windows--data "{\"purge_everything\":true}"

For Windows:

  1. Replace the single quotes with double quotes: ' --> "
  2. Escape the double quotes with a backslash: " --> \"


cmd.exe doesn't support single quotes, to run those commands straight from the docs you can use Bash.

Bash can be enabled in Windows 10 : https://www.laptopmag.com/uk/articles/use-bash-shell-windows-10

or Git Bash comes with Git for windows: https://gitforwindows.org/