From 510f349b83a973c754168441deae33c663a267b2 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Wed, 27 May 2020 13:31:25 +0200 Subject: add tool to convert YAML to JSON --- utils/yaml2json.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 utils/yaml2json.py (limited to 'utils') 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() -- cgit v1.2.3