I am trying to create a table from a JSON file I am receiving from a RESTful API.
When I print the property of the json object I get an output like this:
P
You need to add the parent keyname as a property Name to the nested objects:
$json.Object | ForEach-Object {
foreach ($p in $_.PSObject.Properties) {
$p.Value | Select-Object @{n='Name';e={$p.Name}},*
}
}
Note that PowerShell will render the output in list form by default, since your objects have more than 4 properties. Pipe it through Format-List -AutoSize to get tabular output.