Crates.io | jqk |
lib.rs | jqk |
version | 0.1.3 |
source | src |
created_at | 2023-06-18 12:30:09.349833 |
updated_at | 2023-06-18 12:52:55.59985 |
description | jqk lists key patterns of a JSON file for jq. |
homepage | https://github.com/wkentaro/jqk |
repository | https://github.com/wkentaro/jqk |
max_upload_size | |
id | 893454 |
size | 556,402 |
jqk lists key patterns of a JSON file for jq.
jq is a useful command line tool to filter values from a JSON file quickly on a
terminal; however, knowing the right pattern to extract the target value is not
easy to do especially when a JSON file has so many nests and arrays. jqk helps
to render all keys with the jq patterns so that you can look through a JSON
file using pagers like less
to find the pattern you need to pass to jq.
NOTE: cat xxx.json | jqk
is equivalent to jqk xxx.json
.
$ cat examples/data.json | jqk
{
.departments: [
{
.departments[0].employees: [
"John Doe",
"Jane Doe"
],
.departments[0].head: "John Doe",
.departments[0].name: "Engineering",
.departments[0].projects: [
{
.departments[0].projects[0].budget: 50000,
.departments[0].projects[0].deadline: "2023-12-31",
.departments[0].projects[0].name: "Project A"
},
...
$ cat examples/data.json | jqk -l
.departments
.departments[0].employees
.departments[0].head
.departments[0].name
.departments[0].projects
.departments[0].projects[0].budget
.departments[0].projects[0].deadline
.departments[0].projects[0].name
...
$ cat examples/data.json | jq .departments[].projects[].name
"Project A"
"Project B"
"Campaign X"