A gem to open your one-line-not-indented JSON files in a way that you can read them
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
ricojson.gemspec

README.md

Rico JSON

Code Climate Gem Version Build Status

Description

A gem to open ugly one-line-not-indented JSON files in a way that you can read them.

By default it the JSON (prettified with Ruby's JSON library) to your standard output. You can also pass the -o parameter for it to open the JSON file in your system's default application or text editor for files with the .json extension.

It works only on GNU/Linux and Mac OS X (theoretically).

Install

$ gem install ricojson

Usage

Flags:

  -f file       Read JSON from specified file.
  -o            Opens the resulting formatted JSON in your default
                text editor.
  -h            Prints help message.

Examples

You can just display a JSON file with it:

$ ricojson -f my-terrible-not-indented-json-file.json

Or pipe a file's content:

$ cat other-terrible-not-indented-file.json | ricojson

And display an API's JSON return value directly from your command line:

$ curl https://mnav.heroku.com/artworks/62 | ricojson

And if you want to see this in your default app/text editor use the -o parameter:

$ ricojson -o -f my-terrible-not-indented-json-file.json

Acknowledgements

Thanks @dcadenas for pairing with me and helping me improve the code and functionality. Thanks @poteland for improving the command line options with clap.

Jason picture by Robert Ball - https://secure.flickr.com/photos/robertball/5588712222/ CC License

LICENSE

Copyright © 2014 - Fernando Briano

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.