I'm trying to dynamically build a JsonPath to find elements in an array based on all their properties. Using a static linq query is not an option because my code needs to work with any array. I'm using Newtonsoft.Json 11.0.2 in my C#.net project.
I'm trying with the JsonPath below but I'm getting an Unexpected character while parsing path indexer: , exception. Seems to work on the jsonpath.curiousconcept.com JsonPath tester using any Flow Communications version.
Any help is greatly appreciated! Thanks!
JsonPath: $.arr[?(@.Amount == '1000'),?(@.Name == 'Item A')]
Json:
{
"arr":[
{
"Name":"Item A",
"Amount":1000
},
{
"Name":"Item B",
"Amount":2000
},
{
"Name":"Item C",
"Amount":3000
},
{
"Name":"Item D",
"Amount":4000
}
]
}