public static JEnumerable <JToken> FindFieldsJEnumerable(string fieldname, string payload, IEnumerable <string> filterPermutations) { try { JEnumerable <JToken> returnObj = new JEnumerable <JToken>(); // read by categories JObject rss = JObject.Parse(payload); string wildcardPath = string.Empty; foreach (var ea in filterPermutations) { wildcardPath = ea + fieldname; var _sTokens = rss.SelectTokens(wildcardPath); if (_sTokens.ToList().Count > 0) { bool exists = false; //write the found to a list foreach (var _jtkn in _sTokens) { foreach (var jtoken in returnObj) { if (_jtkn == jtoken) { //DO SOMETHING exists = true; break; } } if (exists == false) { returnObj.Append(_jtkn); } } } } var a = returnObj.Count(); return(returnObj); } catch (Exception ex) { throw ex; } }