Given a JSON array of:
[
{
"id": 1,
"name": "abc"
},
{
"id": 2
},
{
"id": 3,
"name": "def"
}
]
I would expect:
JArray jArray = JArray.Parse(json);
dynamic value = jArray.SelectTokens("$[?(@['name'] == null || @['name'] == 'abc')]");
to produce:
[
{
"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:
[
{
"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.