title: Why do byte arrays turn to gibberish when serialized?
body: <p>What happens to the original structure of the data that was passed through a call like this:</p>
  
  <pre><code> MyImg bytes = new MyImg
              {
                  Id = 1,
                  Img = new byte[] { 1, 0, 5 },
                  Text = "hiiiiiii"
              };
  
          IFormatter formatter2 = new BinaryFormatter();
          using (MemoryStream stream = new MemoryStream())
          {
              formatter2.Serialize(stream, bytes);
              bytes.Img = stream.ToArray();
          }
  </code></pre>
  
  <p>There is a lot of abstraction to how this produces:</p>
  
  <p>{"id":1,"img":"AAEAAAD/////AQAAAAAAAAAMAgAAAEpNZXNzYWdlQm9hcmRCYWNrZW5kLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAUBAAAAJU1lc3NhZ2VCb2FyZEJhY2tlbmQuQ29udHJvbGxlcnMuTXlJbWcDAAAAEzxJZD5rX19CYWNraW5nRmllbGQUPEltZz5rX19CYWNraW5nRmllbGQVPFRleHQ+a19fQmFja2luZ0ZpZWxkAAcBCAICAAAAAQAAAAkDAAAABgQAAAAIaGlpaWlpaWkPAwAAAAMAAAACAQAFCw==","text":"hiiiiiii"}</p>
  
  <p>Im just trying to understand whats going on.</p>
  
  <p>Is serial/deserialization a universal process or does .Net do something different then Java?</p>