]> git.g-eek.se Git - users/gustav/scripts.git/commitdiff
[yaml2json] Inital commit on these scripts
authorGustav Eek <gustav@fripost.org>
Fri, 27 Nov 2015 12:55:24 +0000 (13:55 +0100)
committerGustav Eek <gustav@fripost.org>
Fri, 27 Nov 2015 12:55:24 +0000 (13:55 +0100)
Makefile
json2yaml [new file with mode: 0755]
yaml2json [new file with mode: 0755]

index 7f114e117cd883c90f92c891c7193912c20debf6..bc81ab74abeae02498a4c344d01144e614ba2ef9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,8 @@ msmtp-notify \
 repo-encrypt \
 exiv2-common-edits \
 confluence-tk \
+json2yaml \
+yaml2json \
 
 bash-completion = \
 repo-encrypt \
diff --git a/json2yaml b/json2yaml
new file mode 100755 (executable)
index 0000000..43fdda4
--- /dev/null
+++ b/json2yaml
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+import sys, yaml, json
+yaml.safe_dump(
+  json.load(sys.stdin),
+  sys.stdout,
+  default_flow_style=False)
diff --git a/yaml2json b/yaml2json
new file mode 100755 (executable)
index 0000000..b425c10
--- /dev/null
+++ b/yaml2json
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+import sys, yaml, json
+json.dump(
+  yaml.load(sys.stdin),
+  sys.stdout, indent=4)