title: JavaScriptSerializer error: 'ResponseBody' is not supported for deserialization of an array
body: <p>I'm sending a json string as an http request and recieving a json string in the response. I've created my own classes to serialize from and deserialize into. They look as follows:</p>
  
  <h2>On the Request side -</h2>
  
  <pre><code>public class RequestHead
  {        
      public string source {get; set;}        
      public string dest {get; set;}        
  }
  
  public class RequestBody
  {
      private List&lt;string&gt; id {get; set;}        
      public bool direction {get; set;}
  
      public RequestBody()
      {
          this.id = new List&lt;string&gt;();
      }
  }
  
  public class RequestObj
  {        
      public RequestHead head {get; set;}
      public RequestBody body {get; set;}
  }
  </code></pre>
  
  <h2>On the Response side -</h2>
  
  <pre><code>public class ResponseHead
  {        
      public bool result {get; set;}        
      public float time {get; set;}        
  }
  
  public class ResponseBody
  {        
      public List&lt;string&gt; body{get; set;}
  }
  
  public class ResponseObj
  {        
      public ResponseBody body {get; set;}        
      public ResponseHead head {get; set;}        
  }
  </code></pre>
  
  <h2>In the .asmx file</h2>
  
  <pre><code>            RequestObj request_obj = new RequestObj();
              request_obj.head = head;
              request_obj.body = body;
  
              var httpWebRequest = (HttpWebRequest)WebRequest.Create("the url");
              httpWebRequest.ContentType = "text/json";
              httpWebRequest.Method = "POST";
              JavaScriptSerializer serializer = new JavaScriptSerializer();
  
              using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
              {
                  string json = serializer.Serialize(request_obj);
                  streamWriter.Write(json);
              }
              var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
              using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
              {
                  var responseText = streamReader.ReadToEnd();
                  ResponseObj response_obj = new ResponseObj();
                  response_obj = serializer.Deserialize&lt;ResponseObj&gt;(responseText);
                  ResponseBody response_body = new ResponseBody();
                  response_body = response_obj.body;
                  ResponseHead response_head = new ResponseHead();
                  response_head = response_obj.head;                    
              }
  </code></pre>
  
  <p>I've referred to this post which is exactly the scenario I have - <a href="https://stackoverflow.com/questions/9173811/system-missingmethodexception-error-while-deserialization-of-json-array">System.MissingMethodException: Error while deserialization of json array</a>
  But the solution mentioned here of making a List does not work for me, or I'm doing soemthing else wrong.</p>
  
  <p>Everything works well on the Request end. On the Response end, the body could have 1 string or an array of strings. Whether I  have one or an array, I still get the same error.</p>
  
  <h3>I do not want to use JSON.NET</h3>