title: Overlay data from JSON string to existing object instance
body: <p>I want to deserialize a JSON string which does not necessarily contain data for every member, e.g:</p>
  
  <pre><code>public class MyStructure
  {
     public string Field1;
     public string Field2;
  }
  </code></pre>
  
  <p>Suppose I have an instance:</p>
  
  <pre><code>Field1: "data1"
  Field2: "data2"
  </code></pre>
  
  <p>and I deserialize a string:</p>
  
  <p><code>{ "Field1": "newdata1" }</code></p>
  
  <p>The result should be</p>
  
  <pre><code>Field1: "newdata1"
  Field2: "data2"
  </code></pre>
  
  <p>Framework <code>JavascriptSerializer</code> and <code>JSON.NET</code> both return new objects in their deserialize methods, so the only way I can think of doing this directly would be to compare the deserialized object with the existing one using reflection which seems like a lot of unnecessary overhead. Ideally, some software would have a method in which I passed an existing instance of an object, and only those members which existed in the string would get updated. The point here is that I would like to be able to pass only data which has changed to the server, and update an existing object.</p>
  
  <p>Is this possible using either of these tools, and if not, any suggestions on how to approach the problem?</p>