Last active
August 29, 2015 14:07
-
-
Save mehdi-farsi/243ab2678b5e3b6301b2 to your computer and use it in GitHub Desktop.
Parse and display an unformatted JSON on Terminal
This file contains 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
## Requirements: | |
## | |
## ruby installed | |
$> gem install awesome_print | |
Fetching: awesome_print-1.2.0.gem (100%) | |
Successfully installed awesome_print-1.2.0 | |
Parsing documentation for awesome_print-1.2.0 | |
Installing ri documentation for awesome_print-1.2.0 | |
Done installing documentation for awesome_print after 0 seconds | |
1 gem installed | |
$> cat test.json | ruby -rjson -rawesome_print -e "ap JSON.parse(STDIN.read), multiline: true, indent: 2" | |
[ | |
[0] { | |
"id" => "542878d4975e851f5d91ceef", | |
"index" => 0, | |
"firstname" => "John", | |
"lastname" => "Doe" | |
} | |
] | |
$> |
This file contains 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
[{"id": "542878d4975e851f5d91ceef","index": 0,"firstname":"John","lastname":"Doe"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment