title: How to receive JSON data on WebAPI backend C#?
body: <p>How do I receive JSON data on my WebAPI backend in C#? </p>
  
  <p>I have the following JSON sent from my JavaScript frontend.    </p>
  
  <pre><code>{
      "User_Id": 1,
      "TotalPrice": 35,
      "DeliveryAddress": "At my house",
      "CartItems": [
          {
              "Id": 1009,
              "Name": "Superman juni 2014",
              "Quantity": 1,
              "Price": 35
          }
      ]
  }
  </code></pre>
  
  <p>I have this classes:</p>
  
  <pre><code>public class PurchaseOrder
      {        
          public List&lt;CartItem&gt; CartItems { get; set; }
          public string DeliveryAddress { get; set; }
          public int TotalPrice { get; set; }
          public int User_Id { get; set; }
      }
  public class CartItem
      {
          public int Id { get; set; }
          public string Name { get; set; }
          public int Quantity { get; set; }
          public int Price { get; set; }
      }
  </code></pre>
  
  <p>And my WebAPI method:</p>
  
  <pre><code>[System.Web.Mvc.HttpPost]
          public bool AddOrder(PurchaseOrder order)
          {
              // Here I will do something
  
              return true;
          } 
  </code></pre>
  
  <p>I only get "null" as the result for my "PurchaseOrder order" object. Can the problem be that I´m using [System.Web.Mvc.HttpPost]? I have also tried [System.Web.Http.HttpPost], but get the same result.
  // Martin</p>