title: How to Format List in HttpResponseMessage in WEB API
body: <p>Here, I want the list "User" as a response. But it contains Message also. I want the message to be printed only once. Currently it is printing user.count times. </p>
  
  <pre><code>for (int i = 0; i &lt; user.Count; i++)
   {
     if (user[i].Message == "Success")
        {
          resp = new HttpResponseMessage { Content = new ObjectContent(typeof(List&lt;GetUserList&gt;), user, GlobalConfiguration.Configuration.Formatters.JsonFormatter) };
         }
     else
        {
          resp = new HttpResponseMessage { Content = new StringContent("[{\"Message\":\"" + user[i].Message + "\"}]", System.Text.Encoding.UTF8, "application/json") };
         }
   }
  </code></pre>
  
  <p>The result should be like this:</p>
  
  <pre><code>{
    "message": " Successful",
    "supervisorlist": [
    {
      " userID ": "654",
      " forename ": "John"
    },
    {
      " userID ": "655",
      " forename ": "Jack"
    }
   ]
  
  }
  </code></pre>