在powershell中卷曲不';行不通

在powershell中卷曲不';行不通,powershell,curl,command-line,Powershell,Curl,Command Line,我有一些JSON,我正在尝试与curl一起使用 $json = [char]93 + "{"fields":{"project":{"key":"TEST"},"summary":"Test of the REST","description":"Issue created using the REST API","issuetype":{"name":"Bug"}}}` + [char]93 我使用了[char]39,因为我不能在变量中使用'字符 我正试图使用JIRA Rest API和Po

我有一些JSON,我正在尝试与curl一起使用

$json = [char]93 + "{"fields":{"project":{"key":"TEST"},"summary":"Test of the REST","description":"Issue created using the REST API","issuetype":{"name":"Bug"}}}` + [char]93
我使用了
[char]39
,因为我不能在变量中使用
'
字符

我正试图使用JIRA Rest API和PowerShell发布此JSON。 我已经检查了JSON的格式,cURL还可以(在Linux主机上测试)。 不幸的是,下面的命令对我不起作用

curl https://jira.internal/rest/api/2/issue/ -f -u user:p@ssw0rd! -H "Content-type:application/json" -X POST -d $json

我在Windows的PowerShell 4.0中遇到了同样的问题,并通过 线括号和“@”符号。请尝试以下操作:

$json= @'
{
   "fields":{
       "project":{"key":"TEST"}
   },
   "summary":"Test of the REST",
   "description":"Issue created using the REST API",
   "issuetype":{
        "name":"Bug"
   }  
}
'@

“不起作用”告诉我们的很少。你遇到了什么错误?嗨,耶利米,我收到了400个错误的请求。这很奇怪,因为当我在linux主机上执行相同的操作时,一切都很顺利。我认为这可能是编码的问题,因为当我用UTF-8编码将这个JSON导出到文件中,然后将这个文件抓取到cURL中,它就可以工作了。但我不知道如何设置powershell变量的编码来检查它,我搜索了很多,但没有找到解决方案。