title: How to extract all values from specific key in dictionary?
body: <p>I am trying to extract all the values from the "externalIps" key from this example dictionary</p>
  
  <pre><code>{
      "a": {},
      "b": {},
      "c": {},
      "d": {
          "us-east1-b": {
              "vm1": {
                  "externalIps": [
                      "1.1.1.1"
                  ],
                  "resourceowner": "bob@bob.com"
              }
          }
      },
      "e": {
          "us-east1-b": {
              "vm2": {
                  "externalIps": [
                      "2.2.2.2"
                  ],
                  "resourceowner": "jane@jane.com"
              },
              "vm3": {
                  "externalIps": [
                      "3.3.3.3"
                  ],
                  "resourceowner": "joe@joe.com"
              },
              "vm4": {
                  "externalIps": [
                      "4.4.4.4"
                  ],
                  "resourceowner": "susan@susan.com"
              }
          }
      },
      "f": {},
      "g": {
          "us-east1-b": {
              "vm5": {
                  "externalIps": [
                      "5.5.5.5"
                  ],
                  "resourceowner": "tim@tim.com"
              }
          }
      },
  }
  </code></pre>
  
  <p>I'm using python 3.7.3 on linux.  I have tried many things such as "for key, value in" , and other things I've search for on the web.  Given the different keys everywhere, I'm not sure how to just reference the "externalIps" key and get its values.</p>
  
  <p>Closest I've gotten is something like this, which just seems super-inefficient and fails when I try to go to key5</p>
  
  <pre><code>for key1 in json_data.keys():
      for key2 in json_data[key1].keys():
          for key3 in json_data[key1][key2].keys():
              for key4 in json_data[key1][key2][key3].keys():
                  print(key4)
  </code></pre>
  
  <p>I want the result to be something like this:</p>
  
  <p>1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,5.5.5.5</p>