I have JSONPath:

```none
$.endpointAgents[?(@.clients.userName=~ 'a')].agentId

```

How it will look in `jq` format on Linux??

```sh
jq '.endpointAgents [] | select(.clients.userName=~"a") | {agentId}')"

```

does not work.

Code:

```json
{
  "endpointAgents": [
    {
      "agentId": "MyId",
      "agentName": "MYNAME",
      "location": {
        "locationName": "location"
      },
      "clients": [
        {
          "userProfile": {
            "userName": "Name"
          },
          "browserExtensions": [
            {
              "active": false
            }
          ]
        }
      ],
      "totalMemory": "16222 MB",
      "agentType": "enterprise"
    }
  ]
}

```