[英]Jackson generate JsonSchema from string JSON object
I have a following object: 我有以下对象:
String jsonObject = "{\"cat\": \"nice cat\"}"
From this I want to get com.fasterxml.jackson.module.jsonSchema.JsonSchema
class object. 由此,我想获得
com.fasterxml.jackson.module.jsonSchema.JsonSchema
类对象。
But I can't find a way how to achieve this without having a Java class beforehand. 但是如果没有事先拥有Java类,我将找不到一种方法来实现这一目标。
Any help would be much appreciated. 任何帮助将非常感激。
The goal I am trying to achieve is to generate Kafka Connect Schema from a JSON string. 我试图实现的目标是从JSON字符串生成Kafka Connect Schema。 For this I need first to get
JsonSchema
from a JSON string. 为此,我首先需要从JSON字符串获取
JsonSchema
。
After more research and more thought put into it, such method does not exist for obvious reasons. 经过更多的研究和更多的思考,由于明显的原因,这种方法不存在。 Imagine for example a valid JSON:
假设有一个有效的JSON:
{
"a": [],
"b": null
}
Then there is no way to tell what are types of a
or b
. 这样就无法判断
a
或b
是什么类型。
Therefore I need to be more clever here in what I am trying to achieve. 因此,在这里,我需要变得更加聪明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.