title: Parse json in c# when each name/value pair isn't sent
body: <p>I'm implementing a client/server between a tablet and a PC and I need to pass data back and forth.  After doing some reading json looks like it may be a simple, defined interface to use. I'm using Newtonsoft.Json in my project.</p>
  
  <p>My understanding is that unless it is defined as required in the schema, that each name/value pair doesn't have to be in each message.  If this is true, I'm struggling with how to parse the json object after deserializing it to determine the names that were sent in the message.</p>
  
  <p>For example, If I'm sending weather data and can send json data that looks like</p>
  
  <pre><code>{  "isRaining": false,
     "isSnowing": false,
     "temp": 50.0
  }
  </code></pre>
  
  <p>If I always send all three, then I can create a class that has the same members and assign the data when I deserialize it.</p>
  
  <pre><code>public class Weather
  {
      public bool isRaining { get; set; }
      public bool isSnowing { get; set; }
      public float temp { get; set; }
  }
  
  Weather readWeather = JsonConvert.DeserializeObject&lt;Weather&gt;(data);
  </code></pre>
  
  <p>But I'd like to not have to send ALL the data each transmission.  I really only want to know if something has changed, and then get only the temp name/value pair if the temp has gone up, if whether it's raining or snowing hasn't changed, I don't want to get that data.</p>
  
  <p>It looks like that at least deserializing the data this way, I can't do a for each loop to see what names exist.  Is there any way to do this? Or am I stuck sending all the data all the time?</p>
  
  <p>I will be sending more data in my actual implementation, I only put three pairs here for simplicity.</p>