Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How do I use JsonConvert.DeserializeObject to convert json object to array?

$
0
0

Hi, I sent an array of data using a json post to my asp.net controller like this:: 

 

….code here…..

 

var data = [

  ["", "Kia", "Nissan", "Toyota", "Honda"],

  ["2008", 10, 11, 12, 13],

  ["2009", 20, 11, 14, 13],

  ["2010", 30, 15, 12, 13]

];

 

code here……

   myData = JSON.stringify(data);

code here……

I’ve got this array that I would like to reformat to send to the database. 

In the controller I use this:

 

[HttpPost]

public ActionResult tableData(Object data){}

and get this:

[[\"leaveBlank", \"Kia\", \"Nissan\",\"Totota\",null], [\”2008\”,10,11,12,13,null],[\”2009\”,20,11,14,13,null],[null, null, null, null, null, null]]

How do I use JsonConvert.DeserializeObject  so that I can maybe creagte a multidimentional array like in this case [4,5] and access each element individually?  I've been trying examples I found on sites but they seem to be deserializing a class instead of a method or just the json data that was sent to the controller. 

 Really appreciate any help with this.  Thanks.

 

 

 

 

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>