public virtual HashJson Concat(HashJson json) { foreach (DictionaryEntry de in json) { this.Add(de.Key, de.Value); } return(this); }
public HashJson(string jsonStr) : base() { HashJson json = HashJson.Parse(jsonStr); foreach (DictionaryEntry de in json) { this.Add(de.Key, de.Value); } }
/// <summary> /// 创建HashJson的副本 /// </summary> /// <returns></returns> public virtual HashJson CloneBase() { HashJson hJson = new HashJson(); lock (this) { foreach (DictionaryEntry dic in this) { hJson.Add(dic.Key, dic.Value); } return(hJson); } }
public virtual HashJson AryToHashJson(string [,] args) { HashJson _json = new HashJson(); 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 HashJson Parse(string jsonStr) { HashJson _json = new HashJson(); 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); }