title: python - extract a specific key / value from json file by a variable
body: <p>a bit new to python and json.
  i have this json file:</p>
  
  <pre><code>{ "hosts":  {
               "example1.lab.com" : ["mysql", "apache"],
               "example2.lab.com" : ["sqlite", "nmap"],
               "example3.lab.com" : ["vim", "bind9"]
               }
  }
  </code></pre>
  
  <p>what i want to do is use the hostname variable and extract the values of each hostname.
  its a bit hard to explain but im using saltstack, which already iterates over hosts and i want it to be able to extract each host's values from the json file using the hostname variable.</p>
  
  <p>hope im understood.</p>
  
  <p>thanks
  o.</p>