I have nested JSON file that looks like this
{name:{firstname: Joe, lastname: Bloggs}}
I convert from Json and save as a variable
$json = Get-Content -Path .\file.json -Raw | ConvertFrom-Json
I have a function that retrieves the property path and saves it to a variable
$firstname = "name.firstname"
Why does
$json.$firstname
not return Joe? How can I get Powershell to understand that it should be interpreted as
$json.name.firstname
instead of
$json."name.firstname"
Many thanks.