我尝试制作这样的对象:
$bodyObject = [pscustomobject]@{
'fields' = [pscustomobject]@{
'fixVersions' = @([pscustomobject]@{
'id' = $releaseId
})
}
};
$bodyJson = $bodyObject | ConvertTo-Json;
Write-Output $bodyJson;
我得到以下输出:
{
"fields": {
"fixVersions": [
"@{id=16919}"
]
}
}
我怎样才能实现这样的有效 JSON 结构?
{
"fields": {
"fixVersions": [
{"id": "16919"}
]
}
}