From ddcbdc4f9f890ad67c4baf32b40da275d0dcc5f5 Mon Sep 17 00:00:00 2001 From: ronan Date: Wed, 29 Jun 2016 16:41:08 +0200 Subject: [PATCH] added --- prettyJson.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 prettyJson.py diff --git a/prettyJson.py b/prettyJson.py new file mode 100644 index 0000000..24fc3e2 --- /dev/null +++ b/prettyJson.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import json, sys +from pprint import pprint + +if not sys.stdin.isatty(): + JSON = json.loads(sys.stdin.read()) + pprint(JSON) +else: + print("Use this script with a pipe command.") + print("") + print("echo '...' | python3 prettyJson.py") + print("or") + print("cat ... | python3 prettyJson.py") \ No newline at end of file -- 1.7.9.5