title: Python - Create a single Json from multiple Yaml file of a directory
body: <p>I have multiple yaml files in a directory and want to create a single json from them with selected nodes from each file i.e. we need only 2 to 4 json nodes from a file and not all.</p>
  <p>I am able to read the Yaml and Convert to json but not getting how to select the required nodes from each json/yaml file and create a final single json.</p>
  <p>Can some one suggest me how to select the nodes from all Yaml file and append into a new Json file?</p>
  <p>Using below code, I'm able to convert all YAML file to Separate Json file but not getting how to select nodes from each and create a new Json file.</p>
  <pre><code>import yaml
  import glob
  
  files = glob.glob(&quot;C:\\Users\\test\\*.yaml&quot;)  # list of all .yaml files in a directory
  
  
  def read_yaml_file(filename):
      with open(filename, 'r') as stream:
          try:
              print(yaml.safe_load(stream))
          except yaml.YAMLError as exc:
              print(exc)
  
  
  for file in files:
      data = read_yaml_file(file)
  </code></pre>