I am trying to use JSON.NET SelectToken with JSONPath to select for example the value of longname (eee) where types is only ggg.
JSON snippet:
"results" : [
{
"components" : [
{
"longname" : "aaa",
"shortname" : "bbb",
"types" : [ "ccc", "ddd" ]
},
{
"longname" : "eee",
"shortname" : "fff",
"types" : [ "ggg" ]
}
]
}]
I am unable to get the JSONPath syntax correct. I have tried the following which I think is close to the right solution but always returns null:
o.SelectToken("results[0].components[?(@.types=='[ggg]')].longname")
I have referenced Querying JSON with SelectToken and # JSONPath - XPath for JSON with no joy.