Created
August 7, 2020 22:21
-
-
Save Scags/9c1b97b161a236787da82a658bf56280 to your computer and use it in GitHub Desktop.
JSON to YAML
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 json | |
import yaml | |
import sys | |
def main(): | |
with open(sys.argv[1], "r") as f: | |
j = json.load(f) | |
with open(sys.argv[1].replace("json", "yml"), "w") as f: | |
yaml.safe_dump(j, f, default_flow_style = False, width = 999999) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment