public bool IsCollection(string key) { if (!isModel) { return(false); } if (string.IsNullOrEmpty(key)) { return(false); } foreach (string subjson in base._GetCollection(this.rawjson)) { CommonJsonModel model = new CommonJsonModel(subjson); if (!model.IsValue()) { continue; } if (model.Key == key) { CommonJsonModel submodel = new CommonJsonModel(model.Value); return(submodel.IsCollection()); } } return(false); }
/// <summary> /// 模型是对象,key对应是集合,返回集合 /// </summary> /// <param name="key"></param> /// <returns></returns> public List <CommonJsonModel> GetChild(string key) { if (!isModel) { return(null); } if (string.IsNullOrEmpty(key)) { return(null); } foreach (string subjson in base._GetCollection(this.rawjson)) { CommonJsonModel model = new CommonJsonModel(subjson); if (!model.IsValue()) { continue; } if (model.Key == key) { CommonJsonModel submodel = new CommonJsonModel(model.Value); if (!submodel.IsCollection()) { return(null); } else { List <CommonJsonModel> list = new List <CommonJsonModel>(); if (IsValue()) { return(list); } foreach (string subjson2 in base._GetCollection(model.Value)) { list.Add(new CommonJsonModel(subjson2)); } return(list); } } } return(null); }