Skip to content

Instantly share code, notes, and snippets.

@dhoeric
Last active November 7, 2017 03:59
Show Gist options
  • Save dhoeric/5c05451a391aef86da6a63b34ddff54a to your computer and use it in GitHub Desktop.
Save dhoeric/5c05451a391aef86da6a63b34ddff54a to your computer and use it in GitHub Desktop.
json2yaml

Usage

pip install pyyaml
cat whatever.json | python ./main.py

Example

-> % cat test.json
{
  "id": 123,
  "name": "json2yaml"
}
-> % cat test.json | python main.py
id: 123
name: json2yaml
#!/usr/bin/env python
import json
import yaml
import sys
print ( yaml.dump(json.load(sys.stdin), default_flow_style=False) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment