如何在 linux 命令中使用 jq 解析无名数组 json 中的数据?

How to parse data from a no-name array json using jq in linux command?

[
  {
    "id": 4738245,
    "project_id": 25486,
    "sha": "871c0484c3a7e72deea96fbcd48djdgh2",
    "ref": "",
    "status": "success",
    "created_at": "2022-01-06T04:44:40.372Z",
    "updated_at": "2022-01-06T04:50:36.663Z",
    "web_url": ""
  }
]

以上是我从 gitlab API 得到的 json 响应。我正在尝试使用 jq '.id' 从 json 响应中解析 ID。

我得到的错误是:jq: error (at <stdin>:0): Cannot index array with string "id"

我理解应该是jq '.<arrayName> .id'来解析。但是,响应没有给出任何 arrayName,所以我不能使用那个方法。

显然元素 id 通过包装花括号嵌套在一个对象中,就像其他对象一样,然后将其称为

jq '.[].id'

为了得到值4738245