Commit fad877b279618b2f74ffccc0fe610d54748d60f9
1 parent
1b4aa4cf75
Exists in
master
added new file
Showing 1 changed file with 15 additions and 0 deletions
parserJson.py
View file @
fad877b
1 | +#!/usr/bin/python3 | |
2 | +# -*- coding: utf-8 -*- | |
3 | + | |
4 | +import json, sys | |
5 | +from pprint import pprint | |
6 | + | |
7 | +if not sys.stdin.isatty(): | |
8 | + JSON = json.loads(sys.stdin.read()) | |
9 | + pprint(JSON) | |
10 | +else: | |
11 | + print("Use this script with a pipe command.") | |
12 | + print("") | |
13 | + print("echo '...' | python3 parserJson.py") | |
14 | + print("or") | |
15 | + print("cat ... | python3 parserJson.py") |