public bool IsValue(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.IsValue()); } } return(false); }
/// <summary> /// 当模型是对象,返回拥有的key /// </summary> /// <returns></returns> public List <string> GetKeys() { if (!isModel) { return(null); } List <string> list = new List <string>(); foreach (string subjson in base._GetCollection(this.rawjson)) { string key = new CommonJsonModel(subjson).Key; if (!string.IsNullOrEmpty(key)) { list.Add(key); } } return(list); }
public bool IsValue(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.IsValue(); } } return false; }
/// <summary> /// 当模型是对象,key对应是值,则返回key对应的值 /// </summary> /// <param name="key"></param> /// <returns></returns> public string GetValue(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) return model.Value; } return null; }
/// <summary> /// 当模型是对象,返回拥有的key /// </summary> /// <returns></returns> public List<string> GetKeys() { if (!isModel) return null; List<string> list = new List<string>(); foreach (string subjson in base._GetCollection(this.rawjson)) { string key = new CommonJsonModel(subjson).Key; if (!string.IsNullOrEmpty(key)) list.Add(key); } return list; }