我想使用模式验证json文件.怎么做.
{
"Book_information: [{
"BookName": "English",
"ConfigFile": "English.json",
"dependsOn": "Tamil",
"maxPurchase": "1",
"BookInformation": {
"name": "English",
"id": "English-1"
}
}, {
"BookName": "Tamil",
"ConfigFile": "Tamil.json",
"maxPurchase": "3",
"BookInformation": {
"name": "Tamil",
"id": "Tamil-1"
}
}]
}
解决方法:
如果您正在寻找在线工具,那么您可以尝试
jsonschemalint-online-validator
如果您需要使用Java代码验证它,那么validate-json-against-schema-in-java应该有所帮助.它提供了一步一步的方法,以及示例代码供参考.