apjson

‘apjson’ print parsed json with your favorite format.

Supported Ruby versions and implementations

apjson should work identically on:

  • Ruby 1.9.3+

  • Ruby 1.9.2+

  • Ruby 1.8.7+

Install

You can install apjson by gem.

gem install apjson

Usage

Print json:

$ echo '[1,2,{"key":"val"}]' | apjson
[
    [0] 1,
    [1] 2,
    [2] {
        "key" => "val"
    }
]

Read from file:

$ echo '[1,2,{"key":"val"}]' > sample.json
$ apjson -i sample.json
[
    [0] 1,
    [1] 2,
    [2] {
        "key" => "val"
    }
]

Use p instead of awesome_print:

$ echo '[1,2,{"key":"val"}]' | apjson --p
[1, 2, {"key"=>"val"}]

Trace json:

$ echo '[1,2,{"key":"val"}]' | apjson 0
1

Trace json more:

$ echo '[1,2,{"key":"val"}]' | apjson 2 key
"val"

Read help:

$ apjson --help

Contributing to apjson

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2012 haracane. See LICENSE.txt for further details.