Current Article:

How to pass a JSON string to cURL in Powershell?

How to pass a JSON string to cURL in Powershell?

Try using the --% operator to put PowerShell into simple (dumb) argument parsing mode:

curl.exe --% -ku user@email:password -X PUT -d "data={\"foo\":\"bar\"}" https://your.api.url

This is quite often useful for invoking exes with argument syntax that runs afoul of PowerShell’s argument syntax. This does require PowerShell V3 or higher.