public virtual HashJsonBU Concat(HashJsonBU json) { foreach (DictionaryEntry de in json) { this.Add(de.Key, de.Value); } return(this); }
public HashJsonBU(string jsonStr) : base() { HashJsonBU json = HashJsonBU.Parse(jsonStr); foreach (DictionaryEntry de in json) { this.Add(de.Key, de.Value); } }
/// <summary> /// 创建HashJson的副本 /// </summary> /// <returns></returns> public virtual HashJsonBU CloneBase() { HashJsonBU hJson = new HashJsonBU(); lock (this) { foreach (DictionaryEntry dic in this) { hJson.Add(dic.Key, dic.Value); } return(hJson); } }
public virtual HashJsonBU AryToHashJson(string [,] args) { HashJsonBU _json = new HashJsonBU(); try{ for (int i = 0; i < args.Length; i++) { _json.Add(args[i, 0], args[i, 1]); } }catch (Exception e) { _json["ERROR"] = e.Message; } return(_json); }
public static HashJsonBU Parse(string jsonStr) { HashJsonBU _json = new HashJsonBU(); try { JObject obj = JObject.Parse(jsonStr); JEnumerable <JToken> _children = obj.Children(); foreach (JProperty field in _children) { string name = field.Name; string value = field.Value.ToString(); _json.Add(name, value); } } catch (Exception) { } return(_json); }