13 poin oleh xguru 2020-11-07 | Belum ada komentar. | Bagikan ke WhatsApp
  • Mengubah data JSON menjadi struktur jalur sehingga saat di-grep, lokasinya bisa diketahui dengan mudah

  • Juga mendukung mengubah kembali hanya data struktur jalur yang diekstrak menjadi JSON

  • Untuk array, indeks juga ditampilkan

▶ 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 Windows/Mac/Linux yang ditulis dengan Go. Tanpa dependensi.

Belum ada komentar.

Belum ada komentar.