title: pass a Json complex object to a HttpPost Call
body: <p>So, I'm totally new to web-developing and I have this quite complex object with a lot of fields filled by a JavaScript function.
  I need to pass all this data to a C# <a href="https://i.stack.imgur.com/xgui2.png" rel="nofollow noreferrer">HttpPost Call</a>.
  I used JSON.Stringify to transform all my data in a string and made an <a href="https://i.stack.imgur.com/e4Z0V.png" rel="nofollow noreferrer">Ajax call</a> to pass it to the C# script where there's a class that contains all the expected fields, but once the call starts my input is always Null.</p>
  
  <p>I don't understand if the problem is during the ajax call or inside the httpPost method, can someone help a poor n00b?</p>
  
  <p>ajax call:</p>
  
  <pre><code>$.ajax({
              type: "POST",  
              url: "/playlist",
              data: jsonPlaylist
          })
  </code></pre>
  
  <p>C# method:</p>
  
  <pre><code>public class JsonController : Controller
  {
  
  
      [HttpPost]    
      [Route("playlist")]
      public Playlist getJson([FromBody]string playlist)
      {
          Playlist myPlaylist;
          if (playlist == null)
          {
              return null;
          }
          else
          {
              myPlaylist = JsonConvert.DeserializeObject&lt;Playlist&gt;(playlist);
              return myPlaylist;
          }
      }
  }
  </code></pre>
  
  <p>object class:</p>
  
  <pre><code> public class Playlist
  {
      public struct chunk
      {
          public string id { get; set; }
          public int sizeInBytes { get; set; }
          public float[] times { get; set; }
      }
  
      public struct chunklist
      {
          public string averagetransfertSpeed { get; set; }
          public string id { get; set; }
          public int sizeInBytes { get; set; }
          public float [] times { get; set; }
          public chunk[] chunks { get; set; }
      }
  
      public string id { get; set; }
      public string serverId { get; set; }
      public string clientIp { get; set; }
      public string clientRegion { get; set; }
      public string networkcode { get; set; }
      public int sizeInBytes { get; set; }
      public float [] times { get; set; }
      public float [] chunklistsBandwidth { get; set; }
      public chunklist[] chunklists { get; set; }
  </code></pre>
  
  <p>this is the content of the jsonPlaylist:</p>
  
  <pre><code> "id": "playlist.m3u8",
  "chunklists": [
      {
          "id": "chunklist-f1-v1-a1.m3u8",
          "times": [
              2.4299999931827188,
              0,
              0
          ],
          "chunks": [
              {
                  "id": "seg-1-f1-v1-a1.ts",
                  "times": [
                      139.26500000525266,
                      0,
                      0
                  ],
                  "sizeInBytes": 2671480
              },
              {
                  "id": "seg-2-f1-v1-a1.ts",
                  "times": [
                      179.73499998333864,
                      0,
                      0
                  ],
                  "sizeInBytes": 3336248
              },
              {
                  "id": "seg-3-f1-v1-a1.ts",
                  "times": [
                      228.03500000736676,
                      0,
                      0
                  ],
                  "sizeInBytes": 4259704
              },
              {
                  "id": "seg-4-f1-v1-a1.ts",
                  "times": [
                      145.17000000341795,
                      0,
                      0
                  ],
                  "sizeInBytes": 2716600
              },
              {
                  "id": "seg-5-f1-v1-a1.ts",
                  "times": [
                      104.23500000615604,
                      0,
                      0
                  ],
                  "sizeInBytes": 1874360
              },
              {
                  "id": "seg-6-f1-v1-a1.ts",
                  "times": [
                      183.2799999974668,
                      0,
                      0
                  ],
                  "sizeInBytes": 3167800
              },
              {
                  "id": "seg-7-f1-v1-a1.ts",
                  "times": [
                      167.4300000013318,
                      0,
                      0
                  ],
                  "sizeInBytes": 3098616
              },
              {
                  "id": "seg-8-f1-v1-a1.ts",
                  "times": [
                      159.42499999073334,
                      0,
                      0
                  ],
                  "sizeInBytes": 2993336
              },
              {
                  "id": "seg-9-f1-v1-a1.ts",
                  "times": [
                      172.01999999815598,
                      0,
                      0
                  ],
                  "sizeInBytes": 3243000
              },
              {
                  "id": "seg-10-f1-v1-a1.ts",
                  "times": [
                      174.45500000030734,
                      0,
                      0
                  ],
                  "sizeInBytes": 3116664
              },
              {
                  "id": "seg-11-f1-v1-a1.ts",
                  "times": [
                      149.53999998397194,
                      0,
                      0
                  ],
                  "sizeInBytes": 2833912
              },
              {
                  "id": "seg-12-f1-v1-a1.ts",
                  "times": [
                      177.34000002383254,
                      0,
                      0
                  ],
                  "sizeInBytes": 3149752
              },
              {
                  "id": "seg-13-f1-v1-a1.ts",
                  "times": [
                      181.55000000842847,
                      0,
                      0
                  ],
                  "sizeInBytes": 3363320
              },
              {
                  "id": "seg-14-f1-v1-a1.ts",
                  "times": [
                      188.6649999942165,
                      0,
                      0
                  ],
                  "sizeInBytes": 3570872
              },
              {
                  "id": "seg-15-f1-v1-a1.ts",
                  "times": [
                      151.58999999403022,
                      0,
                      0
                  ],
                  "sizeInBytes": 2854968
              },
              {
                  "id": "seg-16-f1-v1-a1.ts",
                  "times": [
                      140.3850000060629,
                      0,
                      0
                  ],
                  "sizeInBytes": 2475960
              },
              {
                  "id": "seg-17-f1-v1-a1.ts",
                  "times": [
                      213.38999998988584,
                      0,
                      0
                  ],
                  "sizeInBytes": 3847608
              },
              {
                  "id": "seg-18-f1-v1-a1.ts",
                  "times": [
                      15.46500000404194,
                      0,
                      0
                  ],
                  "sizeInBytes": 250040
              }
          ],
          "sizeInBytes": 757,
          "averageTransfertSpeed": "146.3282"
      },
      {
          "id": "chunklist-f2-v1-a1.m3u8",
          "times": [
              0.7949999999254942,
              0,
              0
          ],
          "chunks": [
              {
                  "id": "seg-1-f2-v1-a1.ts",
                  "times": [
                      88.35000000544824,
                      0,
                      0
                  ],
                  "sizeInBytes": 1600632
              },
              {
                  "id": "seg-2-f2-v1-a1.ts",
                  "times": [
                      97.8950000135228,
                      0,
                      0
                  ],
                  "sizeInBytes": 1829240
              },
              {
                  "id": "seg-3-f2-v1-a1.ts",
                  "times": [
                      126.09999999403954,
                      0,
                      0
                  ],
                  "sizeInBytes": 2313528
              },
              {
                  "id": "seg-4-f2-v1-a1.ts",
                  "times": [
                      78.01999998628162,
                      0,
                      0
                  ],
                  "sizeInBytes": 1504376
              },
              {
                  "id": "seg-5-f2-v1-a1.ts",
                  "times": [
                      62.944999983301386,
                      0,
                      0
                  ],
                  "sizeInBytes": 1185528
              },
              {
                  "id": "seg-6-f2-v1-a1.ts",
                  "times": [
                      98.8200000138022,
                      0,
                      0
                  ],
                  "sizeInBytes": 1838264
              },
              {
                  "id": "seg-7-f2-v1-a1.ts",
                  "times": [
                      95.55499997804873,
                      0,
                      0
                  ],
                  "sizeInBytes": 1745016
              },
              {
                  "id": "seg-8-f2-v1-a1.ts",
                  "times": [
                      96.30499998456798,
                      0,
                      0
                  ],
                  "sizeInBytes": 1723960
              },
              {
                  "id": "seg-9-f2-v1-a1.ts",
                  "times": [
                      99.33500000624917,
                      0,
                      0
                  ],
                  "sizeInBytes": 1811192
              },
              {
                  "id": "seg-10-f2-v1-a1.ts",
                  "times": [
                      117.35500002396293,
                      0,
                      0
                  ],
                  "sizeInBytes": 1820216
              },
              {
                  "id": "seg-11-f2-v1-a1.ts",
                  "times": [
                      93.27000001212582,
                      0,
                      0
                  ],
                  "sizeInBytes": 1675832
              },
              {
                  "id": "seg-12-f2-v1-a1.ts",
                  "times": [
                      106.61000001709908,
                      0,
                      0
                  ],
                  "sizeInBytes": 1811192
              },
              {
                  "id": "seg-13-f2-v1-a1.ts",
                  "times": [
                      123.58500002301298,
                      0,
                      0
                  ],
                  "sizeInBytes": 1922488
              },
              {
                  "id": "seg-14-f2-v1-a1.ts",
                  "times": [
                      106.47500000777654,
                      0,
                      0
                  ],
                  "sizeInBytes": 2039800
              },
              {
                  "id": "seg-15-f2-v1-a1.ts",
                  "times": [
                      94.94999999878928,
                      0,
                      0
                  ],
                  "sizeInBytes": 1615672
              },
              {
                  "id": "seg-16-f2-v1-a1.ts",
                  "times": [
                      81.07499999459833,
                      0,
                      0
                  ],
                  "sizeInBytes": 1411128
              },
              {
                  "id": "seg-17-f2-v1-a1.ts",
                  "times": [
                      125.03000002470799,
                      0,
                      0
                  ],
                  "sizeInBytes": 2229304
              },
              {
                  "id": "seg-18-f2-v1-a1.ts",
                  "times": [
                      7.4099999910686165,
                      0,
                      0
                  ],
                  "sizeInBytes": 132728
              }
          ],
          "sizeInBytes": 757,
          "averageTransfertSpeed": "142.9368"
      },
      {
          "id": "chunklist-f3-v1-a1.m3u8",
          "times": [
              1.6149999864865094,
              0,
              0
          ],
          "chunks": [
              {
                  "id": "seg-1-f3-v1-a1.ts",
                  "times": [
                      54.34500001138076,
                      0,
                      0
                  ],
                  "sizeInBytes": 1035128
              },
              {
                  "id": "seg-2-f3-v1-a1.ts",
                  "times": [
                      66.39999998151325,
                      0,
                      0
                  ],
                  "sizeInBytes": 1140408
              },
              {
                  "id": "seg-3-f3-v1-a1.ts",
                  "times": [
                      83.42999999877065,
                      0,
                      0
                  ],
                  "sizeInBytes": 1480312
              },
              {
                  "id": "seg-4-f3-v1-a1.ts",
                  "times": [
                      56.314999994356185,
                      0,
                      0
                  ],
                  "sizeInBytes": 996024
              },
              {
                  "id": "seg-5-f3-v1-a1.ts",
                  "times": [
                      43.1549999921117,
                      0,
                      0
                  ],
                  "sizeInBytes": 773432
              },
              {
                  "id": "seg-6-f3-v1-a1.ts",
                  "times": [
                      64.38500000513159,
                      0,
                      0
                  ],
                  "sizeInBytes": 1167480
              },
              {
                  "id": "seg-7-f3-v1-a1.ts",
                  "times": [
                      59.35500000487082,
                      0,
                      0
                  ],
                  "sizeInBytes": 1113336
              },
              {
                  "id": "seg-8-f3-v1-a1.ts",
                  "times": [
                      63.7249999854248,
                      0,
                      0
                  ],
                  "sizeInBytes": 1119352
              },
              {
                  "id": "seg-9-f3-v1-a1.ts",
                  "times": [
                      63.30500001786277,
                      0,
                      0
                  ],
                  "sizeInBytes": 1158456
              },
              {
                  "id": "seg-10-f3-v1-a1.ts",
                  "times": [
                      65.75000000884756,
                      0,
                      0
                  ],
                  "sizeInBytes": 1161464
              },
              {
                  "id": "seg-11-f3-v1-a1.ts",
                  "times": [
                      58.2400000130292,
                      0,
                      0
                  ],
                  "sizeInBytes": 1083256
              },
              {
                  "id": "seg-12-f3-v1-a1.ts",
                  "times": [
                      61.17500000982545,
                      0,
                      0
                  ],
                  "sizeInBytes": 1161464
              },
              {
                  "id": "seg-13-f3-v1-a1.ts",
                  "times": [
                      65.2399999962654,
                      0,
                      0
                  ],
                  "sizeInBytes": 1206584
              },
              {
                  "id": "seg-14-f3-v1-a1.ts",
                  "times": [
                      73.72499999473803,
                      0,
                      0
                  ],
                  "sizeInBytes": 1317880
              },
              {
                  "id": "seg-15-f3-v1-a1.ts",
                  "times": [
                      57.865000009769574,
                      0,
                      0
                  ],
                  "sizeInBytes": 1044152
              },
              {
                  "id": "seg-16-f3-v1-a1.ts",
                  "times": [
                      54.42500000935979,
                      0,
                      0
                  ],
                  "sizeInBytes": 908792
              },
              {
                  "id": "seg-17-f3-v1-a1.ts",
                  "times": [
                      82.24999997764826,
                      0,
                      0
                  ],
                  "sizeInBytes": 1441208
              },
              {
                  "id": "seg-18-f3-v1-a1.ts",
                  "times": [
                      4.824999981792644,
                      0,
                      0
                  ],
                  "sizeInBytes": 78584
              }
          ],
          "sizeInBytes": 757,
          "averageTransfertSpeed": "143.3341"
      },
      {
          "id": "chunklist-f4-v1-a1.m3u8",
          "times": [
              1.7949999892152846,
              0,
              0
          ],
          "chunks": [
              {
                  "id": "seg-1-f4-v1-a1.ts",
                  "times": [
                      33.18499997840263,
                      0,
                      0
                  ],
                  "sizeInBytes": 568888
              },
              {
                  "id": "seg-2-f4-v1-a1.ts",
                  "times": [
                      52.08000002312474,
                      0,
                      0
                  ],
                  "sizeInBytes": 650104
              },
              {
                  "id": "seg-3-f4-v1-a1.ts",
                  "times": [
                      47.10500000510365,
                      0,
                      0
                  ],
                  "sizeInBytes": 797496
              },
              {
                  "id": "seg-4-f4-v1-a1.ts",
                  "times": [
                      31.75500000361353,
                      0,
                      0
                  ],
                  "sizeInBytes": 565880
              },
              {
                  "id": "seg-5-f4-v1-a1.ts",
                  "times": [
                      25.475000002188608,
                      0,
                      0
                  ],
                  "sizeInBytes": 460600
              },
              {
                  "id": "seg-6-f4-v1-a1.ts",
                  "times": [
                      34.23000001930632,
                      0,
                      0
                  ],
                  "sizeInBytes": 650104
              },
              {
                  "id": "seg-7-f4-v1-a1.ts",
                  "times": [
                      32.765000010840595,
                      0,
                      0
                  ],
                  "sizeInBytes": 620024
              },
              {
                  "id": "seg-8-f4-v1-a1.ts",
                  "times": [
                      35.14500000164844,
                      0,
                      0
                  ],
                  "sizeInBytes": 617016
              },
              {
                  "id": "seg-9-f4-v1-a1.ts",
                  "times": [
                      34.48000000207685,
                      0,
                      0
                  ],
                  "sizeInBytes": 641080
              },
              {
                  "id": "seg-10-f4-v1-a1.ts",
                  "times": [
                      36.075000010896474,
                      0,
                      0
                  ],
                  "sizeInBytes": 641080
              },
              {
                  "id": "seg-11-f4-v1-a1.ts",
                  "times": [
                      35.514999995939434,
                      0,
                      0
                  ],
                  "sizeInBytes": 629048
              },
              {
                  "id": "seg-12-f4-v1-a1.ts",
                  "times": [
                      35.23999999742955,
                      0,
                      0
                  ],
                  "sizeInBytes": 653112
              },
              {
                  "id": "seg-13-f4-v1-a1.ts",
                  "times": [
                      38.14999997848645,
                      0,
                      0
                  ],
                  "sizeInBytes": 662136
              },
              {
                  "id": "seg-14-f4-v1-a1.ts",
                  "times": [
                      41.41999999410473,
                      0,
                      0
                  ],
                  "sizeInBytes": 725304
              },
              {
                  "id": "seg-15-f4-v1-a1.ts",
                  "times": [
                      31.739999976707622,
                      0,
                      0
                  ],
                  "sizeInBytes": 568888
              },
              {
                  "id": "seg-16-f4-v1-a1.ts",
                  "times": [
                      29.27500000805594,
                      0,
                      0
                  ],
                  "sizeInBytes": 535800
              },
              {
                  "id": "seg-17-f4-v1-a1.ts",
                  "times": [
                      45.56999998749234,
                      0,
                      0
                  ],
                  "sizeInBytes": 785464
              },
              {
                  "id": "seg-18-f4-v1-a1.ts",
                  "times": [
                      3.015000023879111,
                      0,
                      0
                  ],
                  "sizeInBytes": 45496
              }
          ],
          "sizeInBytes": 757,
          "averageTransfertSpeed": "139.5362"
      }
  ],
  "times": [
      3.5700000007636845,
      0,
      0
  ],
  "serverId": "servername",
  "clientIp": "ip",
  "clientRegion": "region",
  "networkCode": " code",
  "chunklistsBandwidth": [
      2385338,
      1351592,
      855454,
      461917
  ],
  "sizeInBytes": 572
  </code></pre>
  
  <p>}</p>