Skip to content

Latest commit

 

History

History
74 lines (56 loc) · 1.64 KB

README.mkd

File metadata and controls

74 lines (56 loc) · 1.64 KB

Gron

Build Status

Make JSON greppable!

Gron transforms JSON into discrete assignments to make it easier to grep for what you want and see the absolute 'path' to it. It eases the exploration of APIs that return large blobs of JSON but have terrible documentation.

Usage

Get JSON from a file:

▶ gron testdata/two.json 
json = {};
json.contact = {};
json.contact.email = "[email protected]";
json.contact.twitter = "@TomNomNom";
json.github = "https://github.com/tomnomnom/";
json.likes = [];
json.likes[0] = "code";
json.likes[1] = "cheese";
json.likes[2] = "meat";
json.name = "Tom";

Or from stdin:

▶ curl -s http://headers.jsontest.com/ | gron
json = {};
json.Accept = "*/*";
json.Host = "headers.jsontest.com";
json["User-Agent"] = "curl/7.43.0";
json["X-Cloud-Trace-Context"] = "c70f7bf26661c67d0b9f2cde6f295319/13941186890243645147";

Grep for something and easily see the path to it:

▶ gron testdata/two.json | grep twitter
json.contact.twitter = "@TomNomNom";

Get help:

▶ gron --help
Transform JSON from a file (or stdin) into discrete assignments to make it greppable

Usage:
  gron [jsonfile]

Exit Codes:
  0 OK
  1 Failed to open file
  2 Failed to read input
  3 Failed to decode JSON
  4 Failed to from statements

Examples:
  gron /tmp/apiresponse.json
  curl -s http://headers.jsontest.com/ | gron

Installation

If you're a Go user you can just use go get:

▶ go get github.com/tomnomnom/gron

Or you can download a binary from the releases page.