#!/usr/bin/env python3 import yaml import json import sys from pprint import pprint filename = sys.argv[1] with open(filename) as fp: data = yaml.safe_load(fp) # pprint(data) newfile = filename newfile = newfile.replace(".yaml", ".json") with open(newfile, 'w') as fp: json.dump(data, fp, indent=2) # Cleaning the json: # jq 'del( .meta[ "density", "trade" ])' viper-A-bugz.json # Pretty-print the json: # jq . viper-A-bugz.json > viper-A-bugz-pretty.json