1.My json string is like this following:
{
"TagOptions": {
"AResouceGroupId": "rg-aekzsbuw5climmq",
"BResouceGroupId": "rg-aekztehix5f6eei",
"CResouceGroupId": "rg-aek2t7m7dcjqvhq",
"AClusterGroups": [ 0 ],
"BClusterGroups": [ 0 ],
"CClusterGroups": [ 46 ],
"DClusterGroups": [ 153, 98, 23, 3, 4, 5, 8, 9, 10, 18, 28, 99, 101, 102, 104, 105, 201 ],
"DataDeleiveryTeamProject": [
{
"GroupId": 14,
"ProjectName": "XXX-A"
},
{
"GroupId": 15,
"ProjectName": "XXX-B"
},
{
"GroupId": 46,
"ProjectName": "XXX-C"
},
{
"GroupId": 101,
"ProjectName": "XXX-D"
}
],
"DataCenterTeamProject": [
{
"GroupId": 0,
"ProjectName": "Empty"
}
],
"BazhuayuTeamProject": [
{
"GroupId": 153,
"ProjectName": "XXX-OP1"
},
{
"GroupId": 98,
"ProjectName": "XXX-OP2"
},
{
"GroupId": 23,
"ProjectName": "XXX-OP3"
},
{
"GroupId": 201,
"ProjectName": "XXX-OP4"
},
{
"GroupId": 3,
"ProjectName": "XXX-OP5"
},
{
"GroupId": 4,
"ProjectName": "XXX-OP6"
},
{
"GroupId": 8,
"ProjectName": "XXX-OP7"
},
{
"GroupId": 9,
"ProjectName": "XXX-OP8"
},
{
"GroupId": 10,
"ProjectName": "XXX-OP9"
},
{
"GroupId": 28,
"ProjectName": "XXX-OP10"
},
{
"GroupId": 102,
"ProjectName": "XXX-OP11"
},
{
"GroupId": 103,
"ProjectName": "XXX-OP12"
},
{
"GroupId": 104,
"ProjectName": "XXX-OP13"
},
{
"GroupId": 105,
"ProjectName": "XXX-OP14"
},
{
"GroupId": 18,
"ProjectName": "XXX-OP15"
},
{
"GroupId": 99,
"ProjectName": "XXX-OP16"
}
]
}
}
2.Then,I try to deserialize the json string to a targete class, the target class is following:
using System.Collections.Generic;
namespace Tag
{
public class TagOptions
{
public string AResouceGroupId { get; set; }
public string BResouceGroupId { get; set; }
public string CResouceGroupId { get; set; }
public int[] AClusterGroups { get; set; }
public int[] BClusterGroups { get; set; }
public int[] CClusterGroups { get; set; }
public int[] OctoparseClusterGroups { get; set; }
public List<Project> ATeamProject { get; set; }
public List<Project> BTeamProject { get; set; }
public List<Project> CTeamProject { get; set; }
}
public class Project
{
public int GroupId { get; set; }
public string ProjectName { get; set; }
}
}
the method is like this, I use .netframework4.5 and Newtonsoft.Json
var s = jsonSerializer.Deserialize<CloudNodeTagOptions>(jsonStr);
but the result is null. Is there are some solution to solve the problem?