title: Reading the JSON hierarchy (Number of subnodes can be any number) file using Powershell
body: <p>Reading the JSON hierarchy (Number of subnodes can be any number) file using Powershell.
  I could do it for one level but need the same for N number of loops and nested loops
  Need result in Tree view, if not possible then Tabular way with the title on top of the root table</p>
  <p>Below is the script so far I have developed:</p>
  <pre><code>$Filepath = 'C:\Users\Learner\Test2.JSON'
  $JsonContent=gc $Filepath | ConvertFrom-Json
  $RootNodeCount=$JsonContent.psobject.Properties.name.Count
  $RootNodeName=$JsonContent.psobject.Properties.name
  foreach ($Name in $RootNodeName) {Echo $Name--&gt;  $JsonContent.$Name} 
  </code></pre>
  <p>JSON File</p>
  <pre><code>{
      &quot;foundation&quot;: {
          &quot;network&quot;: {
              &quot;resource_group_name&quot;: &quot;rg-network-e2&quot;,
              &quot;name&quot;: &quot;nonprodvnet-e2&quot;
          },
          &quot;diagnostics&quot;: {
              &quot;resource_group_name&quot;: &quot;rg-mgmt-cu&quot;,
              &quot;storage_account_name&quot;: &quot;Sreacnt-e2&quot;
          },
          &quot;log_analytics&quot;: {
              &quot;resource_group_name&quot;: &quot;rg-mgmt-cu&quot;,
              &quot;workspace_name&quot;: &quot;la-sap-e2&quot;
          },
          &quot;recovery_vault&quot;: {
              &quot;resource_group_name&quot;: &quot;rg-mgmt-cu&quot;,
              &quot;name&quot;: &quot;rsv-sap-e2&quot;
          },
          &quot;windows_domain&quot;: {
              &quot;domain_name&quot;: &quot;dmn.local&quot;,
              &quot;ou_path&quot;: &quot;CN=Computers,DC=example,DC=com&quot;,
              &quot;domain_user&quot;: &quot;svc_domainjoin@dmn.local&quot;,
              &quot;domain_password&quot;: &quot;Pwd01&quot;
          }
      },
      &quot;control_flags&quot;: {
          &quot;enable_boot_diagnostics&quot;: true,
          &quot;enable_oms&quot;: false,
          &quot;enable_backup&quot;: true,
          &quot;windows_domain_join&quot;: false
      },
      &quot;deployment&quot;: {
          &quot;resource_group&quot;: {
              &quot;name&quot;: &quot;rg-sap-501-e2&quot;,
              &quot;location&quot;: &quot;eastus2&quot;
          },
          &quot;tags&quot;: {
              &quot;owner&quot;: &quot;for SAP&quot;
          },
          &quot;os_account&quot;: {
              &quot;admin_username&quot;: &quot;locadm&quot;
          },
          &quot;proximity_placement_groups&quot;: {
              &quot;ppg-501&quot;: {}
          },
          &quot;availability_sets&quot;: {
              &quot;avset-cs-501&quot;: {
                  &quot;ppg_name&quot;: &quot;ppg-501&quot;
              },
              &quot;avset-app-501&quot;: {
                  &quot;ppg_name&quot;: &quot;ppg-501&quot;
              },
              &quot;avset-db-501&quot;: {
                  &quot;ppg_name&quot;: &quot;ppg-501&quot;
              }
          },
          &quot;load_balancers&quot;: {
              &quot;ilb-sap-501&quot;: {
                  &quot;dv2ascs&quot;: {
                      &quot;ip_address&quot;: &quot;192.0.18.20&quot;,
                      &quot;probe_port&quot;: 62000,
                      &quot;subnet&quot;: &quot;app&quot;
                  },
                  &quot;dv2-ers&quot;: {
                      &quot;ip_address&quot;: &quot;192.0.18.21&quot;,
                      &quot;probe_port&quot;: 62102,
                      &quot;subnet&quot;: &quot;app&quot;
                  }
              },
              &quot;ilb-db-501&quot;: {
                  &quot;dv2-hana&quot;: {
                      &quot;ip_address&quot;: &quot;192.0.17.12&quot;,
                      &quot;probe_port&quot;: 62503,
                      &quot;subnet&quot;: &quot;db&quot;
                  }
              }
          },
          &quot;server_groups&quot;: {
              &quot;ascs&quot;: {
                  &quot;os_type&quot;: &quot;linux&quot;,
                  &quot;sku&quot;: &quot;Standard_E4s_v3&quot;,
                  &quot;availability_set&quot;: &quot;avset-cs-501&quot;,
                  &quot;backup_policy&quot;: &quot;sap&quot;,
                  &quot;ppg_name&quot;: &quot;ppg-501&quot;,
                  &quot;lb_refs&quot;: [
                      &quot;dv2-ascs&quot;,
                      &quot;dv2-ers&quot;
                  ],
                  &quot;os_disk_size&quot;: &quot;30&quot;,
                  &quot;enable_accelerated_networking&quot;: true,
                  &quot;hosts&quot;: {
                      &quot;vcs501-01&quot;: {
                          &quot;nics&quot;: [
                              [
                                  &quot;192.0.18.18&quot;
                              ]
                          ]
                      },
                      &quot;vcs501-02&quot;: {
                          &quot;nics&quot;: [
                              [
                                  &quot;192.0.18.19&quot;
                              ]
                          ]
                      }
                  },
                  &quot;subnet&quot;: &quot;app&quot;,
                  &quot;image_details&quot;: {
                      &quot;resource_id&quot;: null,
                      &quot;marketplace_reference&quot;: {
                          &quot;publisher&quot; : &quot;SUSE&quot;,
                          &quot;offer&quot;     : &quot;sles-sap-15-sp1&quot;,
                          &quot;sku&quot;       : &quot;gen1&quot;,
                          &quot;version&quot;: &quot;latest&quot;
                      }
                  },
                  &quot;disks&quot;: [
                      {
                          &quot;name&quot;: &quot;usrsap&quot;,
                          &quot;disk_size&quot;: &quot;128&quot;,
                          &quot;number_of_disks&quot;: 1
                      }
                  ]
              },
              &quot;apps&quot;: {
                  &quot;type&quot;: &quot;app_linux&quot;,
                  &quot;os_type&quot;: &quot;linux&quot;,
                  &quot;sku&quot;: &quot;Standard_E4s_v3&quot;,
                  &quot;availability_set&quot;: &quot;avset-app-501&quot;,
                  &quot;backup_policy&quot;: &quot;sap&quot;,
                  &quot;ppg_name&quot;: &quot;ppg-501&quot;,
                  &quot;enable_accelerated_networking&quot;: true,
                  &quot;os_disk_size&quot;: &quot;30&quot;,
                  &quot;hosts&quot;: {
                      &quot;vas501-01&quot;: {
                          &quot;nics&quot;: [
                              [
                                  &quot;192.0.18.16&quot;,
                                  &quot;192.0.18.26&quot;
                              ]
                          ]
                      },
                      &quot;vas501-02&quot;: {
                          &quot;nics&quot;: [
                              [
                                  &quot;192.0.18.17&quot;,
                                  &quot;192.0.18.27&quot;
                              ]
                          ]
                      }
                  },
                  &quot;subnet&quot;: &quot;app&quot;,
                  &quot;image_details&quot;: {
                      &quot;resource_id&quot;: null,
                      &quot;marketplace_reference&quot;: {
                          &quot;publisher&quot; : &quot;SUSE&quot;,
                          &quot;offer&quot;     : &quot;sles-15-sp1&quot;,
                          &quot;sku&quot;       : &quot;gen1&quot;,
                          &quot;version&quot;: &quot;latest&quot;
                      }
                  },
                  &quot;disks&quot;: [
                      {
                          &quot;name&quot;: &quot;usrsap&quot;,
                          &quot;disk_size&quot;: &quot;128&quot;,
                          &quot;number_of_disks&quot;: 1
                      }
                  ]
              },
              &quot;hana&quot;: {
                  &quot;os_type&quot;: &quot;linux&quot;,
                  &quot;sku&quot;: &quot;Standard_E32s_v3&quot;,
                  &quot;availability_set&quot;: &quot;avset-db-501&quot;,
                  &quot;backup_policy&quot;: &quot;sap&quot;,
                  &quot;ppg_name&quot;: &quot;ppg-501&quot;,
                  &quot;os_disk_size&quot;: &quot;30&quot;,
                  &quot;subnet&quot;: &quot;db&quot;,
                  &quot;lb_refs&quot;: [
                      &quot;dv2-hana&quot;
                  ],
                  &quot;hosts&quot;: {
                      &quot;vhs501-01&quot;: {
                          &quot;nics&quot;: [
                              [
                                  &quot;192.0.17.10&quot;
                              ]
                          ]
                      },
                      &quot;vhs501-02&quot;: {
                          &quot;nics&quot;: [
                              [
                                  &quot;192.0.17.11&quot;
                              ]
                          ]
                      }
                  },
                  &quot;image_details&quot;: {
                      &quot;resource_id&quot;: null,
                      &quot;marketplace_reference&quot;: {
                          &quot;publisher&quot; : &quot;SUSE&quot;,
                          &quot;offer&quot;     : &quot;sles-sap-15-sp1&quot;,
                          &quot;sku&quot;       : &quot;gen1&quot;,
                          &quot;version&quot;: &quot;latest&quot;
                      }
                  },
                  &quot;disks&quot;: [
                      {
                          &quot;name&quot;: &quot;usrsap&quot;,
                          &quot;disk_size&quot;: &quot;128&quot;,
                          &quot;number_of_disks&quot;: 1
                      },
                      {
                          &quot;name&quot;: &quot;hanashared&quot;,
                          &quot;disk_size&quot;: &quot;128&quot;,
                          &quot;number_of_disks&quot;: 1
                      },
                      {
                          &quot;name&quot;: &quot;hanadata&quot;,
                          &quot;disk_size&quot;: &quot;128&quot;,
                          &quot;number_of_disks&quot;: 3
                      },
                      {
                          &quot;name&quot;: &quot;hanalog&quot;,
                          &quot;disk_size&quot;: &quot;128&quot;,
                          &quot;number_of_disks&quot;: 2
                      },
                      {
                          &quot;name&quot;: &quot;hanabackup&quot;,
                          &quot;disk_size&quot;: &quot;512&quot;,
                          &quot;number_of_disks&quot;: 1
                      }
                  ]
              }
          }
      }
  }
  </code></pre>