Skip to content

Instantly share code, notes, and snippets.

@mehdi-farsi
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehdi-farsi/243ab2678b5e3b6301b2 to your computer and use it in GitHub Desktop.
Save mehdi-farsi/243ab2678b5e3b6301b2 to your computer and use it in GitHub Desktop.
Parse and display an unformatted JSON on Terminal
## 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"
}
]
$>
[{"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