Reputation: 73
I am working on a pretty complex json. I have converted whatever needed till now using JSON.Net, but i am stuck in a part of this json. Following is the snippet of the json which i am unable to resolve.
{
"name": "BIRTHDATE",
"path": "BIRTHDATE",
"locale": "IFA_EN_GB",
"hasAnswer": true,
"isSatisfied": false,
"triggeredLines": [],
"answers": [
"100"
],
"validationErrors": {
"100": [
"Please enter a valid date."
],
"10": [
"Please enter a valid date."
].....
},
"definition": null
},
How can i resolve this section.
"validationErrors": {
"100": [
"Please enter a valid date."
],
"10": [
"Please enter a valid date."
].....
}
Class created for deserialization.
public class Question
{
public string name { get; set; }
public string path { get; set; }
public string locale { get; set; }
public bool hasAnswer { get; set; }
public bool isSatisfied { get; set; }
public List<object> triggeredLines { get; set; }
public List<string> answers { get; set; }
public object validationErrors { get; set; }
public object definition { get; set; }
}
Upvotes: 2
Views: 85
Reputation: 136094
This json:
"validationErrors": {
"100": [
"Please enter a valid date."
],
"10": [
"Please enter a valid date."
].....
}
Is a Dictionary<string,string[]>
. so your Question
object should have
public Dictionary<string,string[]> validationErrors { get; set; }
Upvotes: 4