I am sending my array of arrays from the client to the server. Using jQuery ajax method after stringify
like this
JSON.stringify({ list: FinalList })
and on the server side I am getting it like this
{\"list\":[[\"Full Name\"],[\"Select any one\",\"Option 1\",\"Option 2\",\"Option 3\"],[\"address\"],[\"contact name\"]]}
But I am not able to change it to the original form again. I tried using JavaScriptSerializer
but I was not able to get the required result. It's giving me an object
.
How I will deserialize it to it's original form?
The Deserialize< T >(String) method in JavaScriptSerializer requires a Type parameter, which tells it which type to deserialize to.
You must have a class which has the same structure as your javascript object (has a List or Array property which name is "list"), like MyType. Then use Deserialize< MyType >(text) to get the correct MyType instance.
And the MyType class should be like this:
public class MyType
{
public IList<string[]> List { get; set; }
}