I am using Json.net for serializing and then making an JObject that looks like this:
\"RegistrationList\": [
{
\"CaseNumber\": \"120654-1330\",
I think you want to get the JSON string like below:
{
'RegistrationList': [
{
'CaseNumber': '120654-1330',
'Priority': 5,
'PersonId': 7,
'Person': {
'FirstName': '0',
'LastName': '',
},
'UserId': 7,
'User': {
'Id': 7,
'CreatedTime': '2013-07-05T13:09:57.87',
'Comment': ''
}
},
{
'CaseNumber': '120654-1330',
'Priority': 5,
'PersonId': 7,
'Person': {
'FirstName': '0',
'LastName': '',
},
'UserId': 7,
'User': {
'Id': 7,
'CreatedTime': '2013-07-05T13:09:57.87',
'Comment': ''
}
},
]
}
If so, you can get below code working for your question:
string json = @"{
'RegistrationList': [
{
'CaseNumber': '120654-1330',
'Priority': 5,
'PersonId': 7,
'Person': {
'FirstName': '0',
'LastName': '',
},
'UserId': 7,
'User': {
'Id': 7,
'CreatedTime': '2013-07-05T13:09:57.87',
'Comment': ''
}
},
{
'CaseNumber': '120654-1330',
'Priority': 5,
'PersonId': 7,
'Person': {
'FirstName': '0',
'LastName': '',
},
'UserId': 7,
'User': {
'Id': 7,
'CreatedTime': '2013-07-05T13:09:57.87',
'Comment': ''
}
},
]
}";
JObject o = JObject.Parse(json);
JArray list = (JArray)o["RegistrationList"];
List> rList = new List>();
foreach (var r in list)
{
Tuple temp = new Tuple(r["CaseNumber"].Value(), r["Person"]["FirstName"].Value(), r["User"]["Comment"].Value());
rList.Add(temp);
Console.WriteLine(temp);
}