2
{
  "data": {
    "edges": [
      {
        "node": {
          "id": "ABC12345",
          "tags": [
            {
              "name": "Dummy"
            },
            {
              "name": "HelloT"
            }
          ]
        }
      },
      {
        "node": {
          "id": "XYZ123",
          "tags": [
            {
              "name": "Testing"
            },
            {
              "name": "Test"
            }
          ]
        }
      }
    ]
  }
}

I would like to use jmespath on the above json: Return the node if the node.tags[].name that does not contain any Hello* (starts_with)

I have tried the following

(data.edges[].node)[? (tags[])[? !starts_with(name, 'Hello')  ] ]

However it is still returning the first node because it has the tags.name == 'Dummy'

Any advice?

Jason
  • 21
  • 1
  • 2

1 Answers1

2

Ran into the same; turns out wrapping the command (in your case, starts_with) in parentheses should do the trick.

(data.edges[].node)[? (tags[])[? !(starts_with(name, 'Hello')) ] ]

Brad Lucas
  • 175
  • 10