How to add "data" : [
block when using $var | convertTo-Json
?
The actual output of $var
is just a object with some properties which is then converted to json using the command convertTo-Json
.
Here is what I get:
[
{
"controllerID": "0",
"DiskID": "0:1:0",
"cName": "PERCS130",
},
{
"controllerID": "0",
"DiskID": "0:1:1",
"cName": "PERCS130",
}
]
But I need something like this:
{
"data": [
{
"controllerID": "0",
"DiskID": "0:1:0",
"cName": "PERCS130",
},
{
"controllerID": "0",
"DiskID": "0:1:1",
"cName": "PERCS130",
}
]
}