Last active
October 1, 2023 15:36
-
-
Save ashafer01/ef551ce43eba10de467bd293ea4d5941 to your computer and use it in GitHub Desktop.
python single-expression shell aliases to convert between yaml and json. accepts optional filename argument, defaults to stdin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macbook:~ % which yaml-to-json | |
yaml-to-json: aliased to python3 -c 'print(__import__("json").dumps(__import__("yaml").safe_load(open([*__import__("sys").argv[1:],"/dev/stdin"][0]).read()),indent=" "))' | |
macbook:~ % which json-to-yaml | |
json-to-yaml: aliased to python3 -c 'print(__import__("yaml").dump(__import__("json").load(open([*__import__("sys").argv[1:],"/dev/stdin"][0]))),end="")' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment