public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (!(value is SpecialInt val)) { val = new SpecialInt(100); } writer.WriteValue(val.Value); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { SpecialInt val = (SpecialInt)(long)reader.Value; if (val == null) { val = new SpecialInt(100); } return(val); }