public JArray processer(string jsonStr) { String type = ""; String key = ""; String userID = ""; JArray jsa = JArray.Parse(jsonStr); JObject json = JObject.Parse(jsa[0].ToString()); type = json["type"].ToString(); type = json["type"].ToString(); userID = json["userID"].ToString(); SmallClassDao sdao = new SmallClassDao(); List<Model> smdlist = sdao.getModel(type, key, userID); List<SmallClassModel> smlist = new List<SmallClassModel>(); foreach (Model m in smdlist) { smlist.Add((SmallClassModel)m); } JArray jsonArray = new JArray(); foreach (SmallClassModel sm in smlist) { JObject jsonObject = new SmallClassRowMapper().mappingRow(sm); jsonArray.Add(jsonObject); } return jsonArray; }
public Newtonsoft.Json.Linq.JArray processer(string jsonStr) { String type = ""; String key = ""; String userID = ""; JArray jsa = JArray.Parse(jsonStr); JObject json = JObject.Parse(jsa[0].ToString()); type = json["type"].ToString(); key = json["keyWord"].ToString(); userID = json["userID"].ToString(); int m = int.Parse(json["m"].ToString().Trim()); int n = int.Parse(json["n"].ToString().Trim()); SmallClassDao sdao = new SmallClassDao(); List<Model> smdlist = sdao.getModel(type, key, userID,m,n); List<SmallClassModel> smlist = new List<SmallClassModel>(); foreach (Model d in smdlist) { smlist.Add((SmallClassModel)d); } JArray jsonArray = new JArray(); foreach (SmallClassModel sm in smlist) { JObject jsonObject = new SmallClassRowMapper().mappingRow(sm); jsonArray.Add(jsonObject); } return jsonArray; }