Notes on cool things to do with the JSON processor tool
(Link to official jq docs)
.jq files executable
$ echo '"World"' | ./greeting.jq
{
"hello": "World"
}
$ cat greeting.jq
#!/usr/bin/env jq -f
{
hello: .
}chmod +x greeting.jq)-f flag tells jq to
read the filter from fileUnix column formats tab separated output as a table and jq @tsv produces tab separated output.
curl https://jsonplaceholder.typicode.com/users \
| jq -r ".[] | [.id, .address.city, .name] | @tsv" \
| column -ts $'\t'GitHub: vito-c/jq.vim
Written 2020-12