I have a collection of tickets in my HTML code, from which I'm colleting information with JQuery and successfully posting in JSON to codebehind via AJAX.
Here is the JSON file:
{
'arrayTickets':
[
{"num":1,"rec":"SWAFAD","temp":"0","id":"f39443aa-1ae1-4d18-82b8-468f14dac507"},
{"num":1,"rec":"admin","temp":"0","id":"20bf1fea-b03e-4a28-922a-9618c8c8a73f"} ]
}
The problem is I can't seem to be able to deserialize it to the type of structure I want:
[WebMethod]
public static void cmd_gravar_Click(string arrayTickets)
{
JavaScriptSerializer json = new JavaScriptSerializer();
LinkedList<Tuple<int, string, string, string>> tickets = json.Deserialize<LinkedList<Tuple<int, string, string, string>>>(arrayTickets);
}
I get the error:
No parameterless constructor defined for type of 'System.Tuple`4[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
I would like to keep using this structure as I already created a working method that saves the data to the DB with it. This is being done in webforms.
Edit: using VS2012