Skip to content

Instantly share code, notes, and snippets.

@Scags
Created August 7, 2020 22:21
Show Gist options
  • Save Scags/9c1b97b161a236787da82a658bf56280 to your computer and use it in GitHub Desktop.
Save Scags/9c1b97b161a236787da82a658bf56280 to your computer and use it in GitHub Desktop.
JSON to YAML
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