CouchRS.Json.JsonVisitor.ProcessArray C# (CSharp) Method

ProcessArray() protected method

protected ProcessArray ( JToken token, string prefix, string>.List records ) : string>>>.List
token JToken
prefix string
records string>.List
return string>>>.List
        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();
        }