title: How to set json property on powershell using a parameter value as the property name
body: <p>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:</p>
  <pre><code>$json = Get-Content $path -Encoding UTF8 | ConvertFrom-Json
  
  $json.AppSettings.RequiresDocument = $value
  
  </code></pre>
  <p>And it seems to work like that, however if I try to include the parameter like so:</p>
  <pre><code>$json = Get-Content $path -Encoding UTF8 | ConvertFrom-Json
  
  $json.$searchValue = $value
  
  </code></pre>
  <p>I get the error:</p>
  <pre><code>&quot;The property 
  'AppSettings.RequiresDocument' cannot be found on this object. Verify that the property exists and can be set.&quot;
  </code></pre>
  <p>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.</p>