using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
""@encoding"" : ""UTF-8""
""@FeedName"" : ""AdminData"",
""lastName"" : ""Schmoe"",
""firstName"" : ""Steve"",
""int"" : [""4"", ""16"", ""25"", ""20"", ""21"", ""22"", ""17"", ""23"", ""18""]
""firstName"" : ""Bill"",
""lastName"" : ""Gates"",
""int"" : [""3"", ""16"", ""25"", ""20""]
public static void Main()
var jsonString = GetJson();
JObject jsonFeed = JObject.Parse(jsonString);
var query = from people in jsonFeed.SelectTokens("DataFeed.People")
let ids = people.SelectToken("roleIds.int")
where (int)people["active"] == 1 &&
(ids.Type == JTokenType.Array) ?
((int[])ids.ToObject(typeof(int[]))).Any(k => k == 4) :
ResAnFName = (string)people["firstName"],
ResAnLName = (string)people["lastName"]
Console.WriteLine("Query result: ");
Console.WriteLine(JsonConvert.SerializeObject(query, Formatting.Indented));