title: How to receive json in ASP.NET web api?
body: <p>I have an external company pushing data to one of our server, they are going to send JSON data. I need to create a POST api to receive it. This is what I have so far</p>
  
  <pre><code>[System.Web.Http.HttpPost]
  [System.Web.Http.ActionName("sensor")]
  public void PushSensorData(String json)
  {
      string lines = null;
      try
      {
            System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt");
            file.WriteLine(json);
            file.Close();
            //JSONUtilities.deserialize(json);
      }
      catch (Exception ex)
      {
          MobileUtilities.DoLog(ex.StackTrace);
      }
  }
  </code></pre>
  
  <p>I am testing it by send json data using fiddler but json is null.
  This is the raw data from fiddler.</p>
  
  <pre><code>POST http://localhost:31329/mobileapi/pushsensordata/ HTTP/1.1
  User-Agent: Fiddler
  Host: localhost:31329
  Content-Type: application/json
  Content-Length: 533
  
  {
  "id": {
      "server": "0.test-server.mobi",
      "application": "test-server.mobi",
      "message": "00007-000e-4a00b-82000-0000000",
      "asset": "asset-0000",
      "device": "device-0000"
  },
  "target": {
      "application": "com.mobi"
  },
  "type": "STATUS",
  "timestamp": {
      "asset": 0000000
      "device": 00000000,
      "gateway": 000000,
      "axon_received_at": 00000,
      "wits_processed_at": 000000
  },
  "data_format": "asset",
  "data": "asset unavailable"
  }
  </code></pre>