Skip to content

Instantly share code, notes, and snippets.

@wheelerlaw
Created May 17, 2018 14:06
Show Gist options
  • Save wheelerlaw/34eb14cc6993d9dd4ae876586d143797 to your computer and use it in GitHub Desktop.
Save wheelerlaw/34eb14cc6993d9dd4ae876586d143797 to your computer and use it in GitHub Desktop.
A very simple executable script to convert a YAML text stream to a JSON one.
#!/bin/sh
python3 -c '
import sys, yaml, json
try: json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)
except KeyboardInterrupt as e: print("Interrupted. Quitting..."); sys.exit(130)
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment