public JSONObject(JSONObjectBase jsonObject) { //MergeWithJSONObject(jsonObject); if (jsonObject != null) { _InnerObject = jsonObject; } }
public JSONObject(object jsonProperties) { if (jsonProperties == null) { this.Value = null; } else if (jsonProperties as JSONObjectBase != null) { //MergeWithJSONObject((JSONObjectBase)jsonProperties); _InnerObject = (JSONObjectBase)jsonProperties; } else if (jsonProperties.GetType() == typeof(string)) { Value = jsonProperties; } else { foreach (PropertyInfo pi in jsonProperties.GetType().GetProperties()) { object o = pi.GetValue(jsonProperties, null); if (o != null) { if (o.GetType().IsSubclassOf(typeof(JSONObjectBase))) { JSONProperties.Add(pi.Name, (JSONObjectBase)o); } else { JSONProperties.Add(pi.Name, new JSONObject() { Value = o }); } } else { JSONProperties.Add(pi.Name, new JSONObject() { Value = null }); } } } }