@kyanny's blog

My thoughts, my life. Views/opinions are my own.

gron (Make JSON greppable!)

github.com

JSON のキーを連結したものに対して grep できるツール。言われてみれば、こういうことしたいと思いつつ jq で整形したものを頑張って見ていたことが何度もあったなあ、と思った。

❯ curl -s https://api.github.com/ | gron | grep user
json.current_user_authorizations_html_url = "https://github.com/settings/connections/applications{/client_id}";
json.current_user_repositories_url = "https://api.github.com/user/repos{?type,page,per_page,sort}";
json.current_user_url = "https://api.github.com/user";
json.emails_url = "https://api.github.com/user/emails";
json.followers_url = "https://api.github.com/user/followers";
json.following_url = "https://api.github.com/user/following{/target}";
json.keys_url = "https://api.github.com/user/keys";
json.starred_url = "https://api.github.com/user/starred{/owner}{/repo}";
json.user_organizations_url = "https://api.github.com/user/orgs";
json.user_repositories_url = "https://api.github.com/users/{user}/repos{?type,page,per_page,sort}";
json.user_search_url = "https://api.github.com/search/users?q={query}{&page,per_page,sort,order}";
json.user_url = "https://api.github.com/users/{user}";