title: .NET MVC deserialize byte array from JSON Uint8Array
body: <p>I'm using js-scrypt (<a href="https://github.com/tonyg/js-scrypt" rel="noreferrer">https://github.com/tonyg/js-scrypt</a>) on my client-side web application to hash and salt passwords before posting them to my server-side .NET MVC application to be hashed and salted again. This JavaScript library implements byte arrays as JavaScript Uint8Arrays. How do I get my MVC Controller to deserialize my JSON Uint8Array to a byte[]?</p>
  
  <p>JavaScript Example: (AJAX.Post is a library I wrote, myUint8Array serializes properly)</p>
  
  <pre><code>AJAX.Post('www.example.com/SendByteArray', { myByteArray: myUint8Array }, Callback);
  </code></pre>
  
  <p>C# Example: (In my default controller)</p>
  
  <pre><code>[HttpPost]
  public async Task&lt;JsonResult&gt; SendByteArray(byte[] myByteArray) {
  
  }
  </code></pre>
  
  <p>In this example myByteArray is always null. I've tried a couple different approaches based on converting to strings and then back to a byte[] but I haven't been able to get the correct value. It would be greatly preferred if I could somehow implement the code into .NET's JSON deserializer directly so that the code above works exactly as is, because I have a few other projects where I could do some cool things if I could pass byte arrays directly between the server-side and client-side applications.</p>