// JSON to class conversion public override ColibrySerializeHelperCustomClass JSONtoMyClass(JSON root) { checked { PropertyInfo[] properties = this.GetType().GetProperties(); foreach (PropertyInfo p in properties) { string name = p.Name; if (root.fields.ContainsKey(name)) { ColibrySerializeHelper.setProperty(this, p, root, name); } } return(this); } }
// serialize this class to JSON public override JSON ToJSON() { JSON root = new JSON(); PropertyInfo[] properties = this.GetType().GetProperties(); foreach (var p in properties) { if (p.Name == "id") { if (id == null) { continue; } } ColibrySerializeHelper.getProperty(this, p, root, p.Name); } return(root); }