-
-
Save zkan/f8bd74b53aac4c1f5b0e4cb39d717575 to your computer and use it in GitHub Desktop.
Pretty print JSON from stdin. Code base from @aborigines [https://github.com/aborigines]. Base on this story on facebook -> https://www.facebook.com/koonnarate/posts/10202501031914513
This file contains hidden or 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
#!/usr/bin/python | |
import sys | |
import json | |
data = sys.stdin.read() | |
json_data = json.loads("".join(data)) | |
json_string = json.dumps(json_data, sort_keys=True, indent=4, ensure_ascii=False) | |
print(json_string) |
This file contains hidden or 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
{"th" : { "message": "สวัสดี" },"en" : { "message" : "hello" }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment