I'm working on a powershell script where I have to define a certain value for a particular setting that is defined as a parameter. Currently I'm using this:
$json = Get-Content $path -Encoding UTF8 | ConvertFrom-Json
$json.AppSettings.RequiresDocument = $value
And it seems to work like that, however if I try to include the parameter like so:
$json = Get-Content $path -Encoding UTF8 | ConvertFrom-Json
$json.$searchValue = $value
I get the error:
"The property
'AppSettings.RequiresDocument' cannot be found on this object. Verify that the property exists and can be set."
The property does in fact exist and it's the exact same value as before, but for some reason if I switch it for the parameter, I get this error.