protected List<List<Tuple<string, string>>> ProcessArray(JToken token, string prefix, List<List<Tuple<string, string>>> records)
{
// We don't want the key being treated like a member array and thus blowing out the cartesian product
if (prefix == "key")
{
var keyidx = 0;
return token
.Children()
.Select(keyMember => new JProperty(String.Format("key{0}", keyidx++), keyMember.Value<string>()))
.Aggregate(records, (current, tkn) => ProcessProperty(tkn, "", current));
}
if (!token.HasValues)
return records;
return token
.Children()
.Select(x =>
{
var copy = DuplicateList(records);
return Process(x, prefix, copy);
})
.SelectMany(x => x.ToList()).ToList();
}