Question: Given a JSON array of:

```json
[
  {
      "id": 1,
      "name": "abc"
  },
  {
      "id": 2
  },
  {
      "id": 3,
      "name": "def"
  }
]

```

I would expect:

```cs
JArray jArray = JArray.Parse(json);
dynamic value = jArray.SelectTokens("$[?(@['name'] == null || @['name'] == 'abc')]");

```

to produce:

```json
[
  {
    "id": 1,
    "name": "abc"
  },
  {
    "id": 2
  }
]

```

This tests correctly using a variety of online JsonPath testers. But when I run it with Json.NET, I am getting:

```json
[
  {
    "id": 1,
    "name": "abc"
  }
]

```

Is it possible for me to change the JsonPath to handle this? Is it the `null` in the query that is the problem?

For clarity, I need to use JsonPath because it is stored in a configuration file and applied dynamically.

Answer: 
I expect that Newtsoft is considering absence to be different from "present with a null value," whereas the others you've tried consider them to be the same.

I imagine if you update the path to

```
$[?(!@['name'] || @['name'] == null || @['name'] == 'abc')]

```

it might work for you.

Alternatively, updating the data to

```json
[
  {
      "id": 1,
      "name": "abc"
  },
  {
      "id": 2,
      "name": null
  },
  {
      "id": 3,
      "name": "def"
  }
]

```

would also yield the middle item.

---

We haven't defined this yet in the [specification effort](https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base), but it's a good one. I'll raise that in an issue.

You can also see there's no consensus among libraries with [this test](https://cburgmer.github.io/json-path-comparison/results/filter_expression_with_equals_null.html).
With [LINQ to JSON](https://www.newtonsoft.com/json/help/html/LINQtoJSON.htm) you can solve the same problem like this:

```
var json = File.ReadAllText("sample.json");

var semiParsedJson = JArray.Parse(json);
var filteredJson = from item in semiParsedJson
                   let name = (string)item["name"]
                   where name == null || name == "abc"
                   select item;

Console.WriteLine(new JArray(filteredJson));

```

The output will be as expected:

```json
[
  {
    "id": 1,
    "name": "abc"
  },
  {
    "id": 2
  }
]

```