mirror of
https://github.com/tomnomnom/gron
synced 2024-10-18 16:52:20 +00:00
Switches tagline examples to use GitHub API
This commit is contained in:
parent
47b6ac598a
commit
483946d14a
27
README.mkd
27
README.mkd
|
@ -7,20 +7,31 @@ gron transforms JSON into discrete assignments to make it easier to `grep` for w
|
|||
It eases the exploration of APIs that return large blobs of JSON but have terrible documentation.
|
||||
|
||||
<pre>
|
||||
▶ echo '{"is":{"hard":{"to":{"grep":{"gron":{"makes":{"it":"easy"}}}}}}}' | <b>gron</b> | grep easy
|
||||
json.is.hard.to.grep.gron.makes.it = "<b>easy</b>";
|
||||
▶ <b>gron</b> 'https://api.github.com/repos/tomnomnom/gron/commits?per_page=1' | fgrep 'commit.author'
|
||||
json[0].commit.author = {};
|
||||
json[0].commit.author.date = "2016-07-02T10:51:21Z";
|
||||
json[0].commit.author.email = "mail@tomnomnom.com";
|
||||
json[0].commit.author.name = "Tom Hudson";
|
||||
</pre>
|
||||
|
||||
gron can work backwards too, enabling you to turn your filtered data back into JSON:
|
||||
<pre>
|
||||
▶ echo 'it.works.backwards = "too!";' | <b>gron --ungron</b>
|
||||
{
|
||||
"it": {
|
||||
"works": {
|
||||
"backwards": "too!"
|
||||
▶ gron 'https://api.github.com/repos/tomnomnom/gron/commits?per_page=1' | fgrep 'commit.author' | <b>gron --ungron</b>
|
||||
[
|
||||
{
|
||||
"commit": {
|
||||
"author": {
|
||||
"date": "2016-07-02T10:51:21Z",
|
||||
"email": "mail@tomnomnom.com",
|
||||
"name": "Tom Hudson"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
</pre>
|
||||
|
||||
> Disclaimer: the GitHub API documentation is fantastic, but it makes for a good example.
|
||||
|
||||
## Installation
|
||||
|
||||
gron has no runtime dependencies. You can just [download a binary for Linux or Mac and run it](https://github.com/tomnomnom/gron/releases).
|
||||
|
|
Loading…
Reference in a new issue