谁能给我一个如何使用 json 模式的 patternProperties 项目的例子?
"Example" :
"type" : "object",
"patternProperties" :
{
<how do I use this>
}
我想在 json 文件中做的是允许以 A 开头的“示例”的任何子项
例如。:
{
"Example" :
{
"Aaa" : { ...}
}
}
patternProperties 是正确的选择吗?
最佳答案
{
type: 'object',
patternProperties: {
'^A': {
type: 'string',
...
}
}
}
关于patternProperties 的 Json 模式示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9702843/