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
3
votes
3 answers

How do I modify my function to retrieve json objects to a nested json?

Here's the json I currently use in my code : {"forceDeviceLockout":0,"canStartValue":true,"destructOnRead":[30,60,300]} I use the following function to get the json values: private Object getValueForField(Field field) { if…
user2386226
3
votes
2 answers

jsonschema2pojo maven plugin configuration in execution not considered

I am trying to use the jsonschema2pojo plugin for generating POJOs based on both schema and json sourceTypes. The configurations are specified per execution. But every time the plugin is reporting "One of sourceDirectory or sourcePaths must be…
Sandheep
  • 517
  • 3
  • 7
  • 18
3
votes
1 answer

How to skip using @JsonCreator for Enums during deserialization of Json to Java Object?

An Enum Class, ColorName is generated using jsonschema2pojo from ColorName json file.So by default the Enum class has by default fromValue method annotated with @JsonCreator. @JsonCreator public static ColorName fromValue(String value) { …
3
votes
1 answer

Why does Jackson ignore @JsonCreator annotation in my auto-generated POJO Enum?

As usual, there is probaly a very simple solution to my problem: I have a JSON schema snippet that defines the following enum: "title" : { "type": "string", "enum": ["Mr", "Miss", "Mrs", "Ms"], "description": "The person's title" } My…
Christian
  • 6,070
  • 11
  • 53
  • 103
2
votes
1 answer

How can I map Jooq with field joda.time.DateTime to a Pojo with java.time.Instant

I have jooq create TableImpl POJO name CONNECTOR with variable joda.time.DateTime and jsonschema2pojo create POJO name JsonConnector with variable java.time.Instant how to convert jooq select result fetch to jsonschema2pojo create obj List…
deniro.wang
  • 53
  • 1
  • 5
2
votes
0 answers

Can jsonschema2pojo be used to generate classes from json-schema at runtime and instantiate objects from them?

Is there an end-to-end example of using jsonschema2pojo that does the following Generate classes from types defined via json-schema Load the class dynamically Instantiate objects from such a class Populate fields in the object
shrewquest
  • 541
  • 1
  • 7
  • 22
2
votes
3 answers

Maven plugin jsonschema2pojo-maven-plugin not generating pojos for all the definitions

We are using jsonschema2pojo-maven-plugin to generate the java pojos from a json schema file. The plugin is generating the pojos for the definitions that are referred from the schema but not for all the definitions. Is there any option to make the…
user3495691
  • 451
  • 1
  • 5
  • 16
2
votes
1 answer

Handle Serialization and Deserialization with json schema using jsonschema2pojo

I have below json schema and generated java class using jsonschema2pojo library AddressSchema.json { "$id": "https://example.com/address.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "description": "An address similar to…
Nagendra
  • 191
  • 1
  • 3
  • 20
2
votes
0 answers

JSON Schema2Pojo Gradle

I am trying to convert json to java objects while following this example: https://github.com/joelittlejohn/jsonschema2pojo. However, it has problems detecting the Schema2Pojo dependency. Code: /** * Copyright © 2010-2014 Nokia * * Licensed under…
Chiel
  • 662
  • 1
  • 7
  • 30
2
votes
1 answer

Jersey JSON POJO Mapping with Moxy

I am working with Jersey Web services (2.23) and use POJO mapping for the JSON-to-Object mapping (Jersey-media-moxy). I created a class as follows: public class DataPush { public String asset; public String timestamp; public…
user3579222
  • 1,103
  • 11
  • 28
2
votes
3 answers

Retrofit and GSON without pojo

I am using hacker news api in app. I want to make retrofit call using gson factory converter but I am unable to convert response to pojo since it is just list of integers. Following is api call and…
amodkanthe
  • 4,345
  • 6
  • 36
  • 77
2
votes
2 answers

How can I mark as ignored some properties using json schema or jsonschema2pojo?

How can I mark as ignored some properties using json schema or jsonschema2pojo plugin? Sometimes I do receive these properties, sometimes I do not. Here is the exception I am having:…
Flowryn
  • 1,437
  • 1
  • 16
  • 32
2
votes
3 answers

Spring JSR303/349 validation without @Validated

I'm generating POJOs from json schema using jsonschema2pojo. I want to use the jsr303/349 bean validation stuff. I added the necessary items to the classpath, added the necessary beans to trigger the validation, however jsonschema2pojo does not…
StormeHawke
  • 5,987
  • 5
  • 45
  • 73
2
votes
3 answers

How do I avoid jsonschema2pojo generating duplicate classes that I already have?

I have a jsonschema file defining a class that I need as a child class of an already existing POJO (not defined by a schema) As I found on the jsonschema2pojo documentation, the way to do it is: { ... "type": "object", "extends": { "type":…
Iacus
  • 41
  • 1
  • 7
2
votes
0 answers

How to put regex validation for list of string using Jsonschema2pojo

I want to validate list of string (ccEmailAddresses) in my pojo. I'm using Jsonschema2pojo to create Java pojo from json. Json - { "$schema": "http://json-schema.org/draft-03/schema", "title": "Email Recipient", "description": "Schema for an…
1
2
3
11 12