public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { BaseFlowGraph graph = value as BaseFlowGraph; JObject item = (JObject)JToken.FromObject(graph.Output, serializer); item.AddFirst(new JProperty("$type", graph.Output.GetType().Name)); item.WriteTo(writer); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JObject item = JObject.Load(reader); BaseFlowGraph result = Activator.CreateInstance(objectType) as BaseFlowGraph; result.Output = item.ToObject <OutputNode <Status> >(serializer); return(result); }