I am getting this response.How to deserilize the JSON?
[{
"NoOfRecord":"2",
"data":[
{
"name": "Pinky",
"Id": "8989898",
"PhoneNumber": "918934",
"status": "Success",
},
{
"name": "Kajol",
"Id": "2345678",
"PhoneNumber": "915566",
"status": "Fail",
}
]
}]
I tried like this, but getting error.
I have created 2 classes for that.
public class JsonResult2
{
public string NoOfRecord{ get; set; }
public JsonData Data { get; set; }
}
public class JsonData
{
public string name{ get; set; }
public string Id{ get; set; }
public string PhoneNumber{ get; set; }
public string status{ get; set; }
}
When I am writing like this, getting error.
var JsonData = JsonConvert.DeserializeObject<JsonResult2>(ResponseJson);
I am using Newtonsoft's library(using Newtonsoft.Json;)
How to access all name
,id
,phonenumber
and status
.
I am storing obtained response in string called ResponseJson
.
Error : Cannot deserialize JSON array into type 'JsonResult2'