I have some JSON with this schema:
{
"person":{
"name":"test",
"family":"testi"
},
"Employee":{
"id":54,
"department":"web development",
"skils":[{"type":"C#", "grade":"good"},{{"type":"SQL", "grade":"Expert"}}]
}
}
and I need to map this JSON to following classes:
class Employee {
public int id { get; set; }
public string Name { get; set; }
public string Family { get; set; }
public string Department { get; set; }
public Skill[] Skills { get; set;}
}
class skill {
public string Type { get; set; }
public string Grade { get; set; }
}
Now is there any way to map my JSON schema to my C# object?
I am using the Newtonsoft.Json library and am trying to use the JsonProperty
attribute like this:
[JsonProperty("Person.Name")]
on my Employee
class. But this does not work. Is there any way to solve this problem?