针对外部模式文件验证与Jackson的JSON模式符合性 [英] Validate JSON schema compliance with Jackson against an external schema file

查看:111
本文介绍了针对外部模式文件验证与Jackson的JSON模式符合性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Jackson库( https://github.com/FasterXML/jackson )以处理Java中的JSON文件,该文件由JSON模式文件描述.

I would like to use the Jackson library (https://github.com/FasterXML/jackson) to deal with JSON files in Java, which are described by a JSON schema file.

现在,我想验证是否已解析的JSON符合由自己解析的JSON模式文件.

Now, I would like to validate, if a parsed JSON complies with a JSON schema file, which is parsed by itself.

Jackson有一个JSON模式模块( https://github.com/FasterXML/jackson -module-jsonSchema ).但是,在我看来,它的主要重点是从Java内部创建一个JSON模式文件.

There is a JSON schema module for Jackson (https://github.com/FasterXML/jackson-module-jsonSchema). However, it appears to me that its primary focus is on creating a JSON schema file from within Java.

在Java中验证JSON模式的好方法是什么? -最好使用杰克逊(Jackson),但我也愿意接受其他解决方案.

What is a good way to validate a JSON schema in Java? - preferably using Jackson, but I am also open to other solutions.

推荐答案

据我所知,Jackson只能为给定类型生成模式,而不能进行验证.有 json-schema-validator ,但不再维护.

As far as I know Jackson can only produce schemas for given types, but not do validation. There is json-schema-validator but it is no longer maintained.

这篇关于针对外部模式文件验证与Jackson的JSON模式符合性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆