title: Optionally serialize a property based on its runtime value
body: <p>Fundamentally, I want to include or omit a property from the generated Json based on its value at the time of serialization.</p>
  
  <p>More-specifically, I have a type that knows if a value has been assigned to it and I only want to serialize properties of that type if there <em>has</em> been something assigned to it (so I need to inspect the value at runtime).  I'm trying to make it easy for my API to detect the difference between "has the default value" and "wasn't specified at all".</p>
  
  <p>A custom JsonConverter does not seem sufficient; I tried it and I believe the property name is already serialized before the converter is called.  In my case I want to omit even the property name.</p>
  
  <p>I've looked at extending DefaultContractResolver but CreateProperty and CreateProperties (which return JsonProperty serialization metadata) take only the Type being serialized, so I can't inspect the instance itself.  In general, I don't see anything on the DefaultContractResolver allowing me to control <em>if</em> an instance is serialized; maybe I missed it.</p>
  
  <p>I also thought maybe I needed to create a ContractResolver that returned a custom JsonObjectContract for my type.  But, again, I don't see anything on JsonObjectContract that makes decisions based on an instance.</p>
  
  <p>Is there a good way to accomplish my goal?  Am I just missing something simple?  Any help you can provide is greatly appreciated.  Since Json.NET is so extensible, I thought this wouldn't be too hard.  But I'm starting to think I'm way off in the weeds here. :)</p>