title: Encrypt and JSON Serialize an object
body: <p>I have an MVC application and an API, I need to pass a custom credential object from the MVC app to the API for each request. I would like to encrypt the Credentials object and send that in the header of the request to the API.</p>
  
  <p>How can I do that?</p>
  
  <p>I have found tons of articles on how to encrypt a string but none on encrypting an object in a format other than XML.</p>