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
0
votes
1 answer

How to handle field with multiple possible types

Is there a better way to handle a field whose value could be different types in jsonschema2pojo rather than having that field generated as java.lang.Object (this is all caused by legacy data that can't be migrated) For instance, if I have these…
Paul
  • 521
  • 1
  • 5
  • 14
0
votes
0 answers

Mapping Json String Response To Pojo Class

I want to convert my string response to POJO Class. I have already created a POJO Class named account with the below variable but can't map the response to it. My Response [ { "accountNumber": "12345", "accountType": "Banking" }, { "accountNumber":…
0
votes
1 answer

Defining a schema that will be compatible between multiple databases and different conventions

I want to define one schema that will be cross teams & platform valid. This is pretty simple and can be thought of as a kind of ontology. What I need is to have the ability to define what the field represents and under it the name of the field on…
0
votes
1 answer

Can I import table in a JSON Schema validation?

I am writing a JSON schema validation. I have an ID field whose values are imported from a table in SQL Server. These values are large and are frequently updated, so is there a way to dynamically connect to this table in the server and validate the…
0
votes
1 answer

Prevent duplicate class generation (__1) with jsonschema2pojo

I have some json schema that I try to convert to pojo classes using jsonschema2pojo. Unfortunately, I get some duplicated classes generated with an additional __1 postfix on the classname. You can test this at https://www.jsonschema2pojo.org/. Add…
Rainer Jung
  • 636
  • 7
  • 23
0
votes
1 answer

Date object in JSON schema

I have my json schema for createdAt as { "title": "details", "definitions": { "dateTime": { "type": "string", "format": "date-time" }, "properties" : { "createdAt": { "$ref": "#/definitions/dateTime" } } } and when I…
Logic
  • 2,230
  • 2
  • 24
  • 41
0
votes
1 answer

How to set POJO Data on swagger for ApiModelProperty

I have the following ApiModel for my endpoint - public class CreateConfigRequest { @ApiModelProperty(example = "hive") String entityType; @ApiModelProperty(example = "imports") String entityNamespace; @ApiModelProperty(example =…
Shiv
  • 105
  • 7
0
votes
1 answer

JSON Schema relative references resolution

I am trying to define a valid JSON Schema and I am not sure how to structure the reference ("$ref") values when referenced components are in sub-directories. I have read (at length) the info at the official JSON Schema site as well as examined test…
0
votes
2 answers

Converting JSON to POJOs Using Java and assign values

I have some JSON objects and I need to changed them as JAVA classes and assign the given value. { "Summary":{ "AccountSummary":{ "Account_number": "324d", "Account_name": "John" }, "Transaction":[ { "Date": "2021-08-21", …
Deepika
  • 737
  • 7
  • 23
0
votes
2 answers

JsonSchema2Pojo, Date of Birth is generating with Type Number, I am trying to pass the value in Integer

I am currently Generating Pojo class using JsonSchema2Pojo, My json schema has couple of class related to Date of birth, Start Date and End date which is defined with type number, when i generate the Pojo class, its of type Double and I am unable to…
0
votes
1 answer

Mongo response from mongo template not being mapped properly into java object

I have a java pojo created by jsonSchemaPojo2 as so: @JsonInclude(JsonInclude.Include.NON_DEFAULT) @JsonPropertyOrder({ "CardBranding" }) public class RewardsProcessing implements Serializable { @JsonProperty("CardBranding") @NotNull …
Fernando
  • 381
  • 1
  • 5
  • 20
0
votes
0 answers

I'm trying to deserialize a Json using ObjectMapper but it fails to deserialize date value

Solve it by replacing all Date types to String It's a JSON from marvel comics API I'm trying to deserialize and I'm getting "com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of…
0
votes
3 answers

How can I write Java Model Class for Json Schema?

the problem is with coach, goalkeepers and defender like entity I don't know how to make a class for this kind of response { "squad": [ [ "coach", [ { "id": 78621, "name": "Gareth Southgate", …
Ali Tamoor
  • 896
  • 12
  • 18
0
votes
1 answer

Making Pojo class for JSON

Can someone please help me to design pojo class for following json "t_details":{ // this numeric value is dynamic value from server "980303030303": { "key1": "27389237482744", "key2": "" } …
S.Ambika
  • 292
  • 1
  • 14
0
votes
0 answers

How to get value of key when using jsonschema2pojo custom annotator on a input type of JSON

I am creating the POJOs using jsonschema2pojo on inputtype of JSON ( not Json schema ). I need to add the APIModelProperty annotation to each primitive field and I would like to use the value as value for "example"…
adbdkb
  • 1,897
  • 6
  • 37
  • 66