Example #1
0
        public static JSONArray FoldList <T>(this List <T> list, SimpleJsonMapper <T> mapper)
        {
            JSONArray array = new JSONArray();

            for (int i = 0; i < list.Count; i++)
            {
                JSONClass item = mapper.ExportState(list[i]);
                array.Add(item);
            }

            return(array);
        }
Example #2
0
        public static List <T> MapArrayWithMapper <T>(this JSONArray array, SimpleJsonMapper <T> mapper)
            where T : new()
        {
            List <T> result = new List <T>();

            foreach (JSONNode child in array.Childs)
            {
                T newItem = mapper.ImportState(child.AsObject);
                result.Add(newItem);
            }

            return(result);
        }