Hai I have json string like this
[{"StudentId":"3","RollNo":"1"},{"StudentId":"2","RollNo":"2"},{"StudentId":"1","RollNo":"3"},{"StudentId":"4","RollNo":"4"}]
public class Details
{
public string StudentId { get; set; }
public string RollNo { get; set; }
}
Details result = JsonConvert.DeserializeObject<details>(str);
but error showing like this
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'AdmissionService+Details' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
Can anyone help???