Generate JSON schema from Java class

前端 未结 3 1807
栀梦
栀梦 2021-02-03 18:10

I have a POJO class:

public class Stock {
 int id;
 String name;
 Date date;
}

Are there any annotations or development framework/API that can co

3条回答
  •  天命终不由人
    2021-02-03 19:00

    One such tool is Jackson JSON Schema module:

    https://github.com/FasterXML/jackson-module-jsonSchema

    which uses Jackson databind's POJO introspection to traverse POJO properties, taking into account Jackson annotations, and produces a JSON Schema object, which may then be serialized as JSON or used for other purposes.

提交回复
热议问题