是否可以在 Java 中使用 XSD 验证 JSON?我有一个接收 JSON 响应的应用程序,我想根据现有的 XSD 对其进行验证.我的应用程序的另一部分使用 XML,这就是为什么如果它们都可以针对现有的 XSD 进行验证将是最简单的.
Is it possible to validate JSON with an XSD in Java? I have an application where I receive JSON response, and I would like to validate it against existing XSD. Another part of my application uses XML, which is why it would be easiest if they both could validate against the existing XSD.
否, XML Schema (XSD) 用于验证 XML;要验证 JSON,请参阅 JSON 架构.
No, XML Schema (XSD) is for validating XML; to validate JSON, see JSON Schema.
我建议手动生成架构,以便完全理解和完全控制约束.但是,这里有一些可以快速启动流程的自动化工具:
I recommend generating schemas by hand for full understanding and full control over the constraints. However, here are some automated tools that can jumpstart the process:
相关且非常有用:
这篇关于根据 XML Schema (XSD) 验证 JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!