Suppose you got a json data, which you do not know structure, but have to analyze... json2qq is here.
A CLI Tool to extract query templates for jq tool from json data.
Install:
sudo pip3 install git+https://github.com/tos-kamiya/json2jqq.gitUninstall:
sudo pip3 uninstall json2jqqExtract a query template for jq from json data.
$ bash
$ cat > myrepos.json <<EOF
[
{ "author": "Toshihiro Kamiya", "url": "https://github.com/tos-kamiya/json2jqq/" },
{ "author": "Toshihiro Kamiya", "url": "https://github.com/tos-kamiya/giftplayer/" }
]
EOF
$ json2jqq myrepos.json
.[].author
.[].urlEach of extracted queries will work as jq's filter.
$ jq '.[].url' myrepos.json
"https://github.com/tos-kamiya/json2jqq/"
"https://github.com/tos-kamiya/giftplayer/"Option -s will show a sample value for each query.
$ json2jqq -s myrepos.json
.[].author Toshihiro Kamiya
.[].url https://github.com/tos-kamiya/json2jqq/