Questions tagged [jsonschema2pojo]

The jsonschema2pojo is a tool that takes a json schema document and generates DTO-style Java classes (in the form of .java source files).

The jsonschema2pojo is a tool that takes a JSON Schema or JSON document and generates DTO-style Java classes (in the form of .java source files).

There are currently six ways to use jsonschema2pojo:

  1. as a maven plugin
  2. via the command line
  3. as an ant task
  4. as a gradle plugin
  5. directly from your code (embedded) using jsonschema2pojo-core
  6. from the website
174 questions
1
vote
0 answers

How to import a class from a jar in a pojo generation from json

I am using jsonschema2pojo to generate a pojo from a schema like the following: { "$schema":"http://json-schema.org/draft-04/hyper-schema#", "type":"object", "name":"person", "description":"Details about the card to be tokenized.", …
H. Burbano
  • 11
  • 2
1
vote
2 answers

jsonschema2pojo generating enum without any key value pairs

I am using jsonschema2pojo to generate POJO from my JSON schema. However, it does not seem to be working when I am using named enums. Instead of the key value pairs in the POJO, it just adds __EMPTY__. Is there a problem with the way I have…
nikel
  • 3,402
  • 11
  • 45
  • 71
1
vote
1 answer

POJO generated from jsonschema2pojo generating class that should not exist

I am using jsonschema2pojo from command line to create POJO's for the following json's : book_store.json { "type": "object", "$schema": "http://json-schema.org/draft-04/schema", "description": "Books that I have", "properties": { …
nikel
  • 3,402
  • 11
  • 45
  • 71
1
vote
2 answers

How to set the annotationStyle to Gson using jsonschema2pojo-core?

I´m using the jsonschema2pojo-core to parse from JSON to POJO. The thing is I´d like to set the annotationStyle to GSON. (default is Jackson). Any idea? Thanks a lot.
jkrlos
  • 133
  • 1
  • 2
  • 11
1
vote
0 answers

Custom @JsonProperty Annotations

Consider the json schema: { "type":"object", "$schema":"http://json-schema.org/draft-04/schema", "required":false, "properties":{ "inventory":{ "type":"object", "required":false, …
Clarkey
  • 1,553
  • 5
  • 22
  • 34
0
votes
0 answers

We have bult ENUM with jsonschema2pojo 1.0.2 but the same json is not created now

The folowing json was turned into an enum with version 1.0.2 but not with any version after that. { "title": "ApiErrorCode", "description": "", "type": "integer", "format": "int32", "existingJavaType": "java.lang.Integer", "javaType":…
Gjorgi
  • 1
  • 1
0
votes
0 answers

How to get examples from schema to POJOS generated via generated Pojo's via jsonschema2pojo-maven-plugin

We have example keyword in our JSON schema like "examples" : [ "001" ]. How do I add this to the generated Pojo's via jsonschema2pojo-maven-plugin. As the plugin is ignoring the examples keyword and also is there a corresponding JSON annotation for…
Surya
  • 3
  • 2
0
votes
0 answers

Understanding the target package structure of jsonschema2pojo Maven plugin

I use the jsonschema2pojo Maven plugin and have a question about the generated target package structure and where classes end up. The folder structure I have for the JSON schema files is the following: specifications |- A |- B |- C |- components |-…
0
votes
2 answers

Generate json schema and validate json against the schema

How do I generate a JSON schema in Python for the below JSON and validate every json against the schema? Requirements: There is a type which can be CSV or JSON or JSON There is a list of properties. Each property has a key which is a column name…
Harish
  • 565
  • 1
  • 12
  • 34
0
votes
0 answers

jsonschema2pojo is adding some attribute to parent class dynamically

I have a json schema like this: { "JavaType:"com.a.b.c.MyClass", "extends": { "type": "object", "javaType": "com.a.b.MyBaseClass" } } After build is executed jsonschema2pojo is adding some attribute & setter/getter dynamically to…
Manish Kumar
  • 10,214
  • 25
  • 77
  • 147
0
votes
1 answer

JsonSchema2Pojo and manual task in gradle

What I would like to achieve I would like to have a manual gradle task that I can generate Java classes based on Json schema. However, I don't want this task to run when I run other fx. gradle build. What I did Firstly I've create simple gradle java…
PastorPL
  • 968
  • 3
  • 17
  • 36
0
votes
0 answers

jsonschema2pojo configuration to produce minimum POJO and minimum Enums from JsonSchema

I've setup a Java API like this public void convertJsonToJavaClass(URL inputJsonUrl, File outputJavaClassDirectory, String packageName, String javaClassName) throws IOException { com.sun.codemodel.JCodeModel jcodeModel = new…
rupweb
  • 3,052
  • 1
  • 30
  • 57
0
votes
1 answer

jsonschema2pojo gives 1 Properties.java with new POJO for each Json element

I am using Java API like this public void convertJsonToJavaClass(URL inputJsonUrl, File outputJavaClassDirectory, String packageName, String javaClassName) throws IOException { com.sun.codemodel.JCodeModel jcodeModel = new…
rupweb
  • 3,052
  • 1
  • 30
  • 57
0
votes
1 answer

Unable to create jsonschema for retrofit in android. How to generate jsonschema Java?

I want to create JSONschema for Java through jsonschema2pojo but return an empty screen below is a valid JSON string, how to create model classes in java for such JSON string while using retrofit2? [ [ "S#", "Name of Minister", …
Attaullah
  • 3,856
  • 3
  • 48
  • 63
0
votes
0 answers

JsonUnwrapped with jsonschema2pojo jsonschema2pojo-maven-plugin

I want to generate Java POJO class with @JsonUnwrapped by using jsonschema2pojo-maven-plugin, I tried with below jsonSchema but its not generating @JsonUnwrapped annotation { "type": "object", "properties": { "id": { "type": "string" …
Digital
  • 549
  • 1
  • 7
  • 26