Monday, May 20, 2024
Homepage · c#
 Popular · Latest · Hot · Upcoming
182
rated 0 times [  185] [ 3]  / answers: 1 / hits: 10112  / 10 Years ago, fri, may 23, 2014, 12:00:00

Following is my javascript array which I am passing from the server.



string request = @[[1,Name,Sam,20],1,Name,Ram,20]];


I want to convert it into a List of C# object.



public class UpdateData
{
public int RowID { get; set; }

public string ColumnName { get; set; }

public string OldValue { get; set; }

public string NewValue { get; set; }

}


Is there an easy way to do that. Thanks for your help in advance.


More From » c#

 Answers
16

First get a List of Lists and then loop over it to form your List of UpdateData (using Json.Net)



 var obj = JsonConvert.DeserializeObject <List<List<object>>>(request);

[#45085] Thursday, May 22, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
whitney

Total Points: 642
Total Questions: 110
Total Answers: 98

Location: Solomon Islands
Member since Mon, Jun 20, 2022
2 Years ago
;