When I try to access the below JSON file from powershell it show the following error: Missing property name after reference operator. Here is my JSON file:
{
"Vnet": {
"Service": "VirtualNetwork",
"Name": "vnetname",
"ResourceGroupName": "RGname",
"Location": "Southeast Asia",
"Address_Prefix": "11.0.0.0/16",
"No_of_subnets": "1",
"Subnet": {
"1": {
"SubnetName":"sub1",
"Address_Prefix":"11.0.1.0/24"
}
}
}
}
Here is the simple powershell command
$file = (Get-Content "//filelocation" | Out-String) | ConvertFrom-Json
Write-Output $file.Vnet.Subnet.1.SubnetName
Note: I'm author of the JSON file and I can make any changes to it too if needed.