title: Serializing and deserializing Entity Framework version
body: <p>I have a model in my db that has versions, when I <code>GET</code> the object the C# version is a <code>byte[8]</code> but in Json, the object appears to be a string: <code>AAAAAAAACXc=</code> to be precise.</p>
  
  <p>When I do a <code>POST</code> from my js app, my controller accepts a dynamic c# object because the data can be of any of derived classes and I need to be able to deal with all objects. </p>
  
  <p>Currently, I'm doing this to deserialize object : </p>
  
  <pre><code>... Post([FromBody]dynamic data)
  {
      var jsonObj = JsonConvert.DeserializeObject(data.ToString());
  
      //This line errors out
      CareTaker careTaker = JavaScriptSerializer().Deserialize&lt;CareTaker&gt;(jsonObj.ToString());
  }
  </code></pre>
  
  <p>But I get an error: </p>
  
  <blockquote>
    <p>exceptionMessage: "Cannot convert object of type 'System.String' to type 'System.Byte[]'"</p>
  </blockquote>
  
  <p>because in <code>CareTaker</code> class, the <code>Version</code> property is defined as a <code>byte[]</code> but the json string appears as<code>AAAAAAAACXc=</code>..</p>
  
  <p>How do I convert this version string into it's original format of: <code>[0 0 0 0 0 0 9 119]</code> ?</p>
  
  <p>Thank you.</p>
  
  <p>I thought I'd manually override this dynamic property value to byte array, so going this route. I've tried converting the string to normal byte array, but it seems to be more than 8 in length, end EF throws validation error saying that it should either be a string or a <code>byte[]</code> of length 8...</p>