Skip to content

Commit

Permalink
Cleanup convert-yaml-to-json.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmorcos committed Aug 17, 2023
1 parent b3ba6bc commit 893078c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pdns/convert-yaml-to-json.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import sys, json, yaml
"""Convert a YAML file to JSON."""

with open(sys.argv[1], mode='r', encoding='utf-8') as f_in:
with open(sys.argv[2], mode='w', encoding='utf-8') as f_out:
json.dump(yaml.safe_load(f_in.read()), f_out, indent=2, separators=(',', ': '))
import json
import sys

import yaml

yaml_filename = sys.argv[1]
json_filename = sys.argv[2]

with open(yaml_filename, mode="r", encoding="utf-8") as f_in:
with open(json_filename, mode="w", encoding="utf-8") as f_out:
contents = yaml.safe_load(f_in.read())
json.dump(contents, f_out, indent=2, separators=(",", ": "))

0 comments on commit 893078c

Please sign in to comment.