title: How to exclude specific type from json serialization
body: <p>I am logging all requests to my WCF web services, including the arguments, to the database. This is the way I do it:</p>
  
  <ul>
  <li>create a class WcfMethodEntry which derives from PostSharp's aspect OnMethodBoundaryAspect,</li>
  <li>annotate all WCF methods with WcfMethodEntry attribute,</li>
  <li>in the WcfMethodEntry I serialize the method arguments to json with the JsonConvert.SerializeObject method and save it to the database.</li>
  </ul>
  
  <p>This works ok, but sometimes the arguments are quite large, for example a custom class with a couple of byte arrays with photo, fingerprint etc. I would like to exclude all those byte array data types from serialization, what would be the best way to do it?</p>
  
  <p>Example of a serialized json:</p>
  
  <pre><code>[
     {
        "SaveCommand":{
           "Id":5,
           "PersonalData":{
              "GenderId":2,
              "NationalityCode":"DEU",
              "FirstName":"John",
              "LastName":"Doe",
           },
           "BiometricAttachments":[
              {
                 "BiometricAttachmentTypeId":1,
                 "Parameters":null,
                 "Content":"large Base64 encoded string"
              }
           ]
        }
     }
  ]
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>[
     {
        "SaveCommand":{
           "Id":5,
           "PersonalData":{
              "GenderId":2,
              "NationalityCode":"DEU",
              "FirstName":"John",
              "LastName":"Doe",
           },
           "BiometricAttachments":[
              {
                 "BiometricAttachmentTypeId":1,
                 "Parameters":null,
                 "Content":"..."
              }
           ]
        }
     }
  ]
  </code></pre>
  
  <p>Edit: I can't change the classes that are used as arguments for web service methods - that also means that I cannot use JsonIgnore attribute.</p>