Swati Baleri
Swati Baleri

Reputation: 15

Apply filter to an entity within an object using JSONPath

I have the following JSON:

{
  "value": {
    "activate": false
  }
}

I want the JSONPath value to returned as true, but on applying the filter as below:

$.value.?(@.activate==false)

I get an invalid result.

Is there anything wrong with the JSONPath?

Upvotes: 0

Views: 349

Answers (1)

gregsdennis
gregsdennis

Reputation: 8428

The syntax for filter queries needs brackets.

$.value[?(@.activate==false)]

Upvotes: 1

Related Questions