gron - Công cụ biến JSON thành dạng dễ grep
(github.com)-
Chuyển dữ liệu JSON thành cấu trúc đường dẫn để khi grep có thể dễ dàng biết vị trí
-
Cũng hỗ trợ chuyển lại chỉ phần dữ liệu cấu trúc đường dẫn đã trích xuất thành JSON
-
Với mảng, cũng hiển thị cả chỉ mục
▶ gron "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";
▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" | gron --ungron
[
{
"commit": {
"author": {
"date": "2016-07-02T10:51:21Z",
"email": "mail@tomnomnom.com",
"name": "Tom Hudson"
}
}
}
]
▶ gron testdata/two.json
json = {};
json.contact = {};
json.contact.email = "mail@tomnomnom.com";
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";
- Binary cho Windows/Mac/Linux được viết bằng Go. Không có phụ thuộc.
Chưa có bình luận nào.