We are trying to query a JSON array with different (sometimes non existent) attributes. Suppose we have the following:
{
"employees": [
{ "firstName":"John" , "lastName":"Doe" , "favoriteCar":"Ford" },
{ "firstName":"Anna" , "lastName":"Smith", "favoritePet":"Cat", "city":"London" },
{ "firstName":"Peter" , "lastName":"Jones" , "city":"Ankara" }
]
}
As you will notice there are several attributes that do not exist on each "employee" such as "city" or "favoriteCar" and "favoritePet". Given to facts above, can I query this json array with a query string? (any commercial or non-commercial libraries are welcomed)
Sample queries:
- firstName like 'J%'
- city = 'Ankara'
- lastName = 'Doe' AND favoriteCar <> 'Ford'
What I'm trying to do is something like this:
var results = collection.Select("firstName like 'J%'");