title: Return the value and data inside a JSON Array via Python
body: <p>I have a JSON file named <code>&quot;Dev-Env-VNET-vnet-details.json&quot;</code> with the following details below,</p>
  <pre><code>  {
          &quot;location&quot;: &quot;southeastasia&quot;,
          &quot;name&quot;: &quot;Dev-Env-VNET&quot;,
          &quot;properties&quot;: {
              &quot;addressSpace&quot;: {
                  &quot;addressPrefixes&quot;: [
                      &quot;10.0.0.0/16&quot;,
                      &quot;172.16.0.0/16&quot;,
                      &quot;192.168.1.0/24&quot;
                  ]
              },
              &quot;enableDdosProtection&quot;: false,
              &quot;provisioningState&quot;: &quot;Succeeded&quot;,
              &quot;subnets&quot;: [
                  {
                      &quot;name&quot;: &quot;default&quot;,
                      &quot;properties&quot;: {
                          &quot;addressPrefix&quot;: &quot;10.0.0.0/24&quot;,
                          &quot;delegations&quot;: [],
                          &quot;privateEndpointNetworkPolicies&quot;: &quot;Enabled&quot;,
                          &quot;privateLinkServiceNetworkPolicies&quot;: &quot;Enabled&quot;,
                          &quot;provisioningState&quot;: &quot;Succeeded&quot;
                      },
                      &quot;resourceGroup&quot;: &quot;Dev-Env&quot;,
                      &quot;type&quot;: &quot;Microsoft.Network/virtualNetworks/subnets&quot;
                  },
                  {
                      &quot;name&quot;: &quot;Dev-LAN&quot;,
                      &quot;properties&quot;: {
                          &quot;addressPrefix&quot;: &quot;172.16.0.0/24&quot;,
                          &quot;delegations&quot;: [],
                          &quot;privateEndpointNetworkPolicies&quot;: &quot;Enabled&quot;,
                          &quot;privateLinkServiceNetworkPolicies&quot;: &quot;Enabled&quot;,
                          &quot;provisioningState&quot;: &quot;Succeeded&quot;,
                          &quot;serviceEndpoints&quot;: [
                              {
                                  &quot;locations&quot;: [
                                      &quot;*&quot;
                                  ],
                                  &quot;provisioningState&quot;: &quot;Succeeded&quot;,
                                  &quot;service&quot;: &quot;Microsoft.AzureCosmosDB&quot;
                              },
                              {
                                  &quot;locations&quot;: [
                                      &quot;southeastasia&quot;
                                  ],
                                  &quot;provisioningState&quot;: &quot;Succeeded&quot;,
                                  &quot;service&quot;: &quot;Microsoft.Sql&quot;
                              },
                              {
                                  &quot;locations&quot;: [
                                      &quot;southeastasia&quot;,
                                      &quot;eastasia&quot;
                                  ],
                                  &quot;provisioningState&quot;: &quot;Succeeded&quot;,
                                  &quot;service&quot;: &quot;Microsoft.Storage&quot;
                              },
                              {
                                  &quot;locations&quot;: [
                                      &quot;*&quot;
                                  ],
                                  &quot;provisioningState&quot;: &quot;Succeeded&quot;,
                                  &quot;service&quot;: &quot;Microsoft.KeyVault&quot;
                              }
                          ]
                      },
                      &quot;resourceGroup&quot;: &quot;Dev-Env&quot;,
                      &quot;type&quot;: &quot;Microsoft.Network/virtualNetworks/subnets&quot;
                  }
              ]
          },
          &quot;resourceGroup&quot;: &quot;Dev-Env&quot;,
          &quot;tags&quot;: {
              &quot;Environment&quot;: &quot;Dev&quot;
          },
          &quot;type&quot;: &quot;Microsoft.Network/virtualNetworks&quot;
      }
  </code></pre>
  <p>My goal is to return all the <code>names</code> and <code>addressPrefixes</code> under the <code>subnet</code> array in a much readable format. I can already get the <code>name</code> but I have no idea and having a hard time getting the <code>addressPrefixes</code> since it's under <code>properties</code></p>
  <p>Here's my code,</p>
  <pre><code>import json
  
  vnet_data = open('.\Dev-Env-VNET-vnet-details.json')
  vnet_json = json.load(vnet_data)
  
  get_subnets = vnet_json['properties']
  subnet = get_subnets['subnets']
  for s in range(len(subnet)):
      print(&quot;Subnet name: {}, addressPrefix: {} &quot;.format(subnet[s][&quot;name&quot;],subnet[s][&quot;properties&quot;]))
  </code></pre>
  <p>And here's the result,</p>
  <pre><code>Subnet name: default, addressPrefix: {'addressPrefix': '10.0.0.0/24', 'delegations': [], 'privateEndpointNetworkPolicies': 'Enabled', 'privateLinkServiceNetworkPolicies': 'Enabled', 'provisioningState': 'Succeeded'} 
  Subnet name: Dev-LAN, addressPrefix: {'addressPrefix': '172.16.0.0/24', 'delegations': [], 'privateEndpointNetworkPolicies': 'Enabled', 'privateLinkServiceNetworkPolicies': 'Enabled', 'provisioningState': 'Succeeded', 'serviceEndpoints': [{'locations': ['*'], 'provisioningState': 'Succeeded', 'service': 'Microsoft.AzureCosmosDB'}, {'locations': ['southeastasia'], 'provisioningState': 'Succeeded', 'service': 'Microsoft.Sql'}, {'locations': ['southeastasia', 'eastasia'], 'provisioningState': 'Succeeded', 'service': 'Microsoft.Storage'}, {'locations': ['*'], 'provisioningState': 'Succeeded', 'service': 'Microsoft.KeyVault'}]}
  </code></pre>
  <p>Here's what I'm expecting or trying to achieve,</p>
  <pre><code>Subnet name: default, addressPrefix: 10.0.0.0/24
  Subnet name: Dev-LAN, addressPrefix: 172.16.0.0/24
  </code></pre>
  <p>How am I going to achieve this? Thanks!</p>