以下是JSON数据示例。我想以编程方式获取它的JSON模式。模式生成应该动态发生,这意味着JSON数据可以在不同的请求中不断变化
{
"Users":[{
"Individual": {
"IndividualInfo": {
"Title": "Mr",
"Suffix": "",
"CountryOfBirth": "US",
"CountryOfCitizenship": {
"Country": [
"US", "CA"
]
},
"CountryOfResidence": "US",
"USGreencard": "No",
"CountryOfMarriage": "US",
"VIP": "Yes"
},
"IdentificationInfo": {
"Identification": [{
"Country": "US",
"ValidToDate": "12/31/2037"
}, {
"Country": "CA",
"ValidToDate": "12/31/2019"
}
]
},
"EmploymentInfo": {
"Employment": [{
"EmployerName": "EmpNameee",
"WorkspaceName": "SDAS"
}
]
}
}
}]
}
答案 0 :(得分:0)
JSON.NET Schema可以解决这个问题。这就是它的建议:
JSchemaGenerator generator = new JSchemaGenerator();
JSchema schema = generator.Generate(typeof(Users));