Powershell curl double quotes
Pipe the data into curl.exe, instead of trying to escape it.
$data = @{
fields = @{
project = @{
key = "key"
}
summary = "summary"
description = "description - here"
type = @{
name = "Task"
}
}
}
$data | ConvertTo-Json -Compress | curl.exe -X POST -u username:password -H "Content-Type: application/json" -d "@-"
curl.exe reads stdin if you use @-
as your data parameter.
P.S.: I strongly suggest you use a proper data structure and ConvertTo-Json
, as shown, instead of building the JSON string manually.
Easy way (for simple testing):
curl -X POST -H "Content-Type: application/json" -d '{ \"field\": \"value\"}'