I am trying to create a hashtable that i can then convert to a json body variable. When i do that it is wrapping all the values in quotes, but the integer value needs to look like [34,56] and not like “[34,56]”
Here is the syntax per the json examples:
{
“portId”: “CL1-A”,
“hostGroupName”: “My_REST_API_HOST”,
“hostModeOptions”: [12,33],
“hostMode”: “AIX”
}
Here is what i am using for my powershell code
#region Create HostGroup
$uri_hostgroup_Create = 'http://10.65.77.147:23450/ConfigurationManager/v1/objects/storages/800000056031/host-groups'
$json_load = [ordered]@{
"portId" = "CL1-A"
"hostGroupName" = "Test_restapi_hostgroup2"
"hostModeOptions"= '[54,63]'
"hostMode"= "VMWARE_EX"
}
$json_payload = $json_load|ConvertTo-Json
$json_payload
Here is the outcome:
{
“portId”: “CL1-A”,
“hostGroupName”: “Test_restapi_hostgroup2”,
“hostModeOptions”: “[54,63]”,
“hostMode”: “VMWARE_EX”
}
Any thoughts on how i can get the values without the quotes. I assume its happening becouse it thinks its a string, but i cant find away to show it as a int.
Thanks in advance.