jq
JSONを整形してくれるコマンドラインツール
直近1000件のタイトルを表示
$ curl https://scrapbox.io/api/pages/suto3\?limit=1000 | jq '.pages[].title'
直近10件のタイトルと概要を表示
$ curl https://scrapbox.io/api/pages/suto3\?limit=10 | jq '.pages[] | {t: .title, d: .descriptions}'
このページを表示
$ curl https://scrapbox.io/api/pages/suto3/jq | jq '.lines[].text'
Scrapboxのエクスポートファイルから、先頭の 10件分、インポートデータを取り出す
$ cat path/to/export-file.json | jq '[.pages0:10[] |{title: .title, lines: [.lines[]]}]'
Scrapboxのエクスポートファイルから、先頭の10件分、インポートファイルを作り出す。
$ (echo -n '{ "pages": ' && cat path/to/your-export-file.json | jq '[.pages0:10[] |{title: .title, lines: [.lines[]]}]' && echo '}') > your-import-file.json
$ jq . your-import-file.json
https://stedolan.github.io/jq/manual/
JSON (JavaScript Object Notation)
cURL(Client for URLs)
sed
grep
AWK
#commandline
https://ricapitolare.vercel.app/svg?url=https://github.com/stedolan/jq#.png https://github.com/stedolan/jq