Fix notification parsing
This commit is contained in:
parent
4e28893225
commit
879242a69d
|
@ -35,10 +35,7 @@ public class NotificationConverter : JsonConverter
|
|||
{
|
||||
JObject jo = JObject.Load(reader);
|
||||
Type noteClass = FindNotificationSubclass((string)jo["type"]);
|
||||
// Dirty hack to use a Type variable as a type in a generic method
|
||||
// TODO: There probably is a nicer way to do this.
|
||||
var method = typeof(JObject).GetMethod("ToObject").MakeGenericMethod(new Type[] { noteClass });
|
||||
return method.Invoke(jo, new object[] { serializer });
|
||||
return Convert.ChangeType(jo.ToObject(noteClass), noteClass);
|
||||
}
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
|
Reference in New Issue