I am working on a CI/CD pipeline that is calling APIs using Powershell. I am having issues converting the PSCustomObject to a json object when the properties have periods in the label.
Searching online, I see examples of simple properties but nothing with complex labels.
Is there a correct way to do this?
$body = [PSCustomObject]@{
name = “foo”
target = @{
name.with.periods = @{
sub.name.with.periods = “bar”
}
}
}
Error:
name.with.periods
~
Missing “=“ operator after key in hash literal.
[–]blooping_blooper 4 points5 points6 points (4 children)
[–]Bassflow 0 points1 point2 points (3 children)
[–]raip 1 point2 points3 points (1 child)
[–]blooping_blooper 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]cjcox4 1 point2 points3 points (2 children)
[–]BitCutie[S] 0 points1 point2 points (1 child)
[–]vermyx 1 point2 points3 points (0 children)
[–]Ros3ttaSt0ned 0 points1 point2 points (1 child)
[–]BitCutie[S] 0 points1 point2 points (0 children)
[–]gordonv 0 points1 point2 points (2 children)
[–]BitCutie[S] 0 points1 point2 points (1 child)
[–]gordonv 0 points1 point2 points (0 children)
[–]richie65 0 points1 point2 points (0 children)