I get cannot deserialize error when the items in the json list is 1 , it works when the items are > 1
This is my json
{
"avetmiss": {
"disabilities": {
"disability": [
{
"disability-type": "Physical"
},
{
"disability-type": "Hearing/Deaf"
}
]
},
"prior-educations": {
"prior-education": {
"id": "2",
"prior-education-type": "Bachelor Degree or Higher Degree level"
}
}
}}
and this is the class with which I deserialize
public class Root {
public PriorEducations prioreducations { get; set; }
[JsonProperty("disabilities")]
public Disabilities disabilities { get; set; }
}
public class Disabilities
{
[JsonProperty("disability")]
public List<DisabilityType> disability { get; set; }
}
public class DisabilityType
{
[JsonProperty("disability-type")]
public string disabilitytype { get; set; }
}
public class PriorEducations
{
[JsonProperty("prior-education")]
public List<PriorEducation> prioreducation { get; set; }
}
public class PriorEducation
{
[JsonProperty("id")]
public string id { get; set; }
[JsonProperty("prior-education-type")]
public string prioreducationtype { get; set; }
}
So basically it works with Disabilities but not with prior education (because the items in Disabilities are >1 where as prior edu.. is 1 ) It works if I change the prioreducation[] to prioreducation