title: How to override complex type property with string value using DefaultContractResolver while json serialization
body: <p>I have a class with multiple properties where some of the properties are complex type, those it self having their own multiple properties, I am looking a way to get only one property to serialize from complex type.</p>
  <p>For example I have these 3 class</p>
  <pre><code>class Organization
  {
      public Int32 ID {get; set;}
      public string Name {get; set;}
      public Geography Location {get; set;}
  }
  
  class Geography 
  {
      public Int32 GeoID {get; set;}
      public string Country {get; set;}
      public string City {get; set;}
      public string State {get; set;}
  }   
  </code></pre>
  <p>here I want to serialize the Organization class object, that should take only 'Country' from property 'Location' along with other properties, the json string output I am expecting as below using <code>JsonConvert.SerializeObject</code> method from NewtonSoft library.</p>
  <pre><code>{
     &quot;ID&quot;:1,
     &quot;Name&quot;:&quot;Sales&quot;,
     &quot;Location&quot;:&quot;India&quot;
  }
  </code></pre>
  <p>I don't want to do it using anonymous type as serializable object, because this implementation I need to keep common for every object those are being sterilizing with this property type.</p>
  <p>I am experimenting using <code>DefaultContractResolver</code> as I already have implementation to exclude selected property from serialization, in same implementation I tried by overriding <code>CreateProperty</code> method but its failing in conversion, also I am unable to get the value to set with newly created property as shown below. This is a try only I have no idea whether this is the right method to use for required functionlity! please suggest.</p>
  <pre><code>protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
  {
      var property = base.CreateProperty(member, memberSerialization);
      JsonProperty newproperty = property;
  
      if (property.PropertyType == typeof(Geography))
      {
          newproperty = new JsonProperty()
          {
              PropertyName = property.PropertyName,
              PropertyType = typeof(string)
              //How to get the value from parent property to set with newproperty? 
          };
      }
      return newproperty;
  }
  </code></pre>