Browse Source

Utilities to convert between YAML and JSON

user-stack-check-macro
Sami Vaarala 10 years ago
parent
commit
e5e3faf61c
  1. 5
      util/json2yaml.py
  2. 4
      util/yaml2json.py

5
util/json2yaml.py

@ -0,0 +1,5 @@
import os, sys, json, yaml
if __name__ == '__main__':
# Use safe_dump() instead of dump() to avoid tags like "!!python/unicode"
print(yaml.safe_dump(json.load(sys.stdin), default_flow_style=False))

4
util/yaml2json.py

@ -0,0 +1,4 @@
import os, sys, json, yaml
if __name__ == '__main__':
print(json.dumps(yaml.load(sys.stdin)))
Loading…
Cancel
Save