Given this piece of code
$Object = @"
{
"Item1":{
"Subitem1":{
"Subsubvalue":"Value"
}
},
"Value1":"value1"
}
"@ | ConvertFrom-Json
and given the following string (that I don't know at runtime, I've just got a string with an object path)
$String = "$Object.Item1.Subitem1.Subsubvalue"
I am trying to do the following - but I can't find a way to make it work
PS C:\> $Substring = $string.substring(8)
PS C:\> $Object.$Substring
Value
My ultimate goal is to get to modify the contents of that
PS C:\> $Object.$Substring = "something else"
Obviously $substring approach doesn't work, nor the other approaches I've tried.