Created
April 8, 2022 09:21
-
-
Save ltpitt/836c66f37ec493e672eaa646327a2309 to your computer and use it in GitHub Desktop.
Simple cli tool to translate a YAML file to JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
import json | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('yaml', help='Enter YAML file path') | |
args = parser.parse_args() | |
with open(args.yaml) as infile: | |
os_list = yaml.load(infile, Loader=yaml.FullLoader) | |
print(json.dumps(os_list, indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment