Client Side Deserialization Process
===

Hi I’m serializing data in the server in the following way:
       
       .c
        int BUFSIZE = 1024;
       unsigned char buf[BUFSIZE];
      unsigned int data2[1000]; 
      char *p;

      len = generate_http_header(buf, "js", 1280);
      p = buf + len;
      for (j=0; j<640; j++)
      {
     char_out[1]=data2[j]&0x00FF;
     char_out[0]=(data2[j]>>8)&0x00FF;
     *p=char_out[0];
     p=p+1;
     *p=char_out[1];
     p=p+1;
     }
     ....
    tcp_write(pcb, buf, len, 1);
    tcp_output(pcb);


 I want to send the integers 0,1,2,3,4,5,6,7,8,9,10……639. The data is sent using TCP/IP protocol. In the client side as response I receive a JSON text

        .js
       success: function(o) {
       var bin=o.responseText;
       alert(bin);
        …..
        }

The result of the alert is weird:

          <=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
          {|}~��������������������������������
           �����������������������������������
           �����������������������������������
           ��������������������������

How can I have retrieve the integers 0,1,2,3….639? Which deserialization process would be better to use in this case? Do I need to convert the string to and JSON object in order to deserialize? Is it possible to do something like this in Java Script?

      char array[1280]; // incoming network data
      int next = 0;
      value = 0;
      value |= (int)*((unsigned char*)array)[next++];
      value |= (int)*((unsigned char*)array)[next++] << 8;
     

