jqf v1.8.0

jqf v1.8.0

  • ドキュメント
  • ヘルプ
  • ブログ
  • Languages icon日本語
    • English

›ドキュメンテーション

ドキュメンテーション

  • インストール
  • API リファレンス
  • 実用的な利用方法

実用的な利用方法

JSON API を処理する

Jqf を使って、 JSON API から得られた JSON を処理することができます。

最初に JSON API の例を確認してみます。

$ curl 'https://raw.githubusercontent.com/kamataryo/jqf/main/examples/students.json'
[
  { "id": 1, "name": "Adams", "score": 70 },
  { "id": 2, "name": "Baker", "score": 58 },
  { "id": 3, "name": "Clark", "score": 82 },
  { "id": 4, "name": "Davis", "score": 93 },
  { "id": 5, "name": "Evans", "score": 61 }
]

それでは、学生のスコアをリストとしてピックアップしてみます。

$ curl 'https://raw.githubusercontent.com/kamataryo/jqf/main/examples/students.json' | \
  jqf 'students => students.map(student => student.score)'
[
  70,
  58,
  82,
  93,
  61
]

ショートハンド記法を使うこともできます。

$ curl 'https://raw.githubusercontent.com/kamataryo/jqf/main/examples/students.json' | \
  jqf map 'student => student.score'
[
  70,
  58,
  82,
  93,
  61
]
← API リファレンス
  • JSON API を処理する
jqf v1.8.0
Documentations
Install GuideAPI referencePractical Use
More
GitHubJqf is Licensed under the MIT License.
Copyright © 2024 kamataryo