English 中文(简体)
jq select using a boolean attribute in deep nested array
原标题:
  • 时间:2023-10-16 03:00:18
  •  标签:
  • jq

How can i select / filter all connection with field.encryptedValueSet is true using jq from JSON data below

{
  "connections": {
    "connection": [
      {
        "field": [
          {
            "id": "url",
            "encryptedValueSet": false,
            "usesEncryption": false,
            "componentOverride": false,
            "useDefault": false
          },
          {
            "id": "user",
            "encryptedValueSet": false,
            "usesEncryption": false,
            "componentOverride": false,
            "useDefault": false
          },
          {
            "id": "password",
            "encryptedValueSet": true,
            "usesEncryption": true,
            "componentOverride": false,
            "useDefault": false
          }
        ],
        "id": "3ea89002-51f5-4369-9539-63c3bd406a64",
      }
    }
]
}

I tried following but not working as desired

jq  . | select(.connections.connection[].field[] | .encryptedValueSet==true)  EnvironmentExtensions.json
jq  . | .connections.connection[].field[] | select(.encryptedValueSet==true)  EnvironmentExtensions.json
问题回答

暂无回答




相关问题
why can t $module be used as a variable name? in jq

Is this behaviour of jq, w.r.t the non-allowed use of $module as a variable name, specified anywhere? $ jq -n --arg module X $module jq: error: syntax error, unexpected module, expecting IDENT ...

热门标签