using System.ComponentModel;
using System.Runtime.Serialization;
public static void Main()
string json = @"{ ""StringProp"" : ""foo"" }";
Console.WriteLine("--- Deserialize ---");
MyClass mc = JsonConvert.DeserializeObject<MyClass>(json);
Console.WriteLine("StringProp: " + mc.StringProp);
Console.WriteLine("--- Manual change ---");
Console.WriteLine("--- Serialize ---");
json = JsonConvert.SerializeObject(mc);
public class MyClass : INotifyPropertyChanged
if (_StringProp != value)
RaisePropertyChanged("StringProp");
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
if (_isDeserializing) return;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
Console.WriteLine(propertyName + " was changed " + DateTime.Now);
bool _isDeserializing = false;
internal void OnDeserializingMethod(StreamingContext context)
internal void OnDeserializedMethod(StreamingContext context)
_isDeserializing = false;