summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutils/yaml2json.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/yaml2json.py b/utils/yaml2json.py
new file mode 100755
index 0000000..13ff641
--- /dev/null
+++ b/utils/yaml2json.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+import yaml
+import json
+import sys
+
+if __name__ == "__main__":
+ i = open(sys.argv[1], "r") if sys.argv[1:] else sys.stdin
+ o = open(sys.argv[2], "w") if sys.argv[2:] else sys.stdout
+ o.write( json.dumps( yaml.safe_load( i.read() ), indent=4))
+ i.close()
+ o.close()