Hi,
I would like to create a json file from the below content replacing the <SERIAL> , <MD5_CHECKSUM>, <LINEAGE> etc with some values.
{
"data": {
"type": "state-versions",
"attributes": {
"serial": <SERIAL>,
"md5": "<MD5_CHECKSUM>",
"lineage": "<LINEAGE>",
"state": "<BASE64_CONTENT>"
}
}
I have tried to achieve this with below code:
$obj = @{
"data" = @{
"types" = "state-versions"
"attributes" = @{
"serial" = $integer
"md5" = $md5.hash
"lineage" = $lineage
"state" = $Encoded
}
}
}
# Convert object to JSON
$json = $obj | ConvertTo-Json
# Save JSON to file
$json | Set-Content -Path $jsonFile
However whenever I am pushing this json file to Vxrail Manager using invoke-restmethod to update some properties, I am getting some conflict error which depicts that there is some issue with my json file formatting.
What is the best way of creating this json file using powercli.