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); }
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); }