FasterXML / jackson-module-jsonSchema

Module for generating JSON Schema (v3) definitions from POJOs
371 stars 135 forks source link

Where can I upload and get JSon and JSON schema file? #149

Closed kbhanderi1608 closed 2 years ago

kbhanderi1608 commented 2 years ago

I have no experience with JSON and trying to understand this project. can you help me with following questions?

  1. Where can I upload my own JSON file (myJson.json)?
  2. which particular file in the this project generating the JSON schema and after completion Where does the JSON Schema file goes?

Thanks,

cowtowncoder commented 2 years ago

For usage questions please use mailing list:

https://groups.google.com/g/jackson-user

But as to your question; did you actually go through README?

This is not a command-line tool but rather tool to create JSON Schema that represents given Java object type(s). So you cannot upload anything.

As README says:

Example Usage

ObjectMapper mapper = new ObjectMapper();
// configure mapper, if necessary, then create schema generator
JsonSchemaGenerator schemaGen = new JsonSchemaGenerator(mapper);
JsonSchema schema = schemaGen.generateSchema(SimpleBean.class);

This will yield a java POJO representing a JSON Schema, which can itself easily be serialized with jackson, or configured with java.

So you get a Java object and then if you want JSON version, use Jackson ObjectMapper like so:

String json = new ObjectMapper().writeValueAsString(schemaObject);