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

jsonschema2pojo: How to apply annotations to certain fields

I'm using jsonschema2pojo, and some of my fields need special serialization/de-serialization. How do I set that up in the json schema? Here's my schema so far: "collegeEducation": { "javaJsonView":…
CNDyson
  • 1,687
  • 7
  • 28
  • 63
1
vote
1 answer

Enum not getting generated correctly by jsonschema2pojo-maven-plugin

I have the following field in json schema of a request: "orderType": { "type": "string", "description": "The orderType indicator.", "enum": [ …
humbleCoder
  • 667
  • 14
  • 27
1
vote
2 answers

JSON to JAVA POJO with dynamic key

I am trying to convert from JSON to JAVA POJO. My JSON-string looks like the following: { "api": { "results": 1, "fixtures": [ { "fixture_id": 38480, "league_id": 95, "lineups": { "Lecce": { …
JavaNisse
  • 17
  • 5
1
vote
0 answers

jsonschema2pojo is not creating generated java object

I'm trying to use jsonschema2pojo to convert the FHIR schema to a java object. If I use this example schema then the generated java classes are create just fine, but when I use this Json Schema then nothing is created and I don't see any errors to…
Travis Frazier
  • 441
  • 3
  • 13
1
vote
2 answers

Not able to convert json to pojo class, getting com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException exception

This is my JsonObject JSONObject input = new JSONObject("{\n" + " \"ColumnNames\":[\"col1\", \"col2\", \"col3\", \"col4\", \"col5\"]\n" + "}"); My POJO Class public class RequestClass { private List
Rachit Jain
  • 103
  • 2
  • 11
1
vote
1 answer

JSON Schema multiple instances of a property

I'm trying to define a json schema where there are multiple properties that instances of the same object for a Java application endpoint. A simple example of what I'm trying to do is this { "$schema":…
Jason Warner
  • 2,469
  • 1
  • 11
  • 15
1
vote
2 answers

Having null response for a list of objects in REST API call with RestTemplate

So I'm working on a REST client that consumes a REST API to get a JSON object using the Spring RestTemplate. So I get an HTTP 200 OK response but the list (equipment) inside the class object is null. But other fields are fetched. When I do the same…
GeekySelene
  • 847
  • 3
  • 13
  • 31
1
vote
1 answer

How to show that each key of an object will have the same type?

I have a JSON response that return various metrics as values of and confidence that I would like represent as a JSON Schema (as well generating beans from using JsonSchema2Pojo). { "QPI": { "value": 0.053916827852998075, …
Sled
  • 18,541
  • 27
  • 119
  • 168
1
vote
2 answers

How to create POJO class for retrofit with dynamic keys names

I am sorry but i couldn't even phrase the question well but here it goes. I am getting a JSON response like this: { "results": { "b2bc01": [{ "message": "Successfully created", "_id": "596c8b25ce2350e41600002f", …
1
vote
1 answer

Include null values in JSON (jsonschema2pojo-maven-plugin Version-0.4.11)

When you generate java class using this plugin it applies JsonInclude.Include.NON_NULL in genarted class. How to override this default configuration from @JsonInclude(JsonInclude.Include.NON_NULL) to @JsonInclude(JsonInclude.Include.ALWAYS) in…
Dev Gosain
  • 690
  • 8
  • 15
1
vote
0 answers

Use JsonSchema to extract few attributes from JSON

I am trying to write a tool, which will take the json schema from the user where they can specify the attributes they want to extract out the json and save it. I figured out that using jsonschema and jsonschema2pojo, I can generate the pojo out of…
plzdontkillme
  • 1,497
  • 3
  • 20
  • 38
1
vote
2 answers

JsonSchema2Pojo ignoreunknownproperty doesnt work

I am using JsonSchema2Pojo for converting json to Model objects. It creates Model objects as expecetd. But, I need the annotation @JsonIgnoreProperties(ignoreUnknown = true) as well. There is no way to have this annotation with this JsonSchema2Pojo.…
user1578872
  • 7,808
  • 29
  • 108
  • 206
1
vote
2 answers

handle response which has different type in Retrofit 2

Need help with handling different JSON field types response in Retrofit 2 The serverapi return 2 different types of response and both in Http 200 OK: if success, server will return this response: …
1
vote
1 answer

Create generic Java classes without modifying JSON data

I have a very unique use case where I have some JSON data incoming from a third party which I can't modify. { "Information": { "mobile": { "name": "Mobile Application", "classType" : "A" }, …
1
vote
2 answers

JSON in Java class using POJO approach

So I want to use the POJO approach to handle a JSON file in my coding, so I will have a class with getters and setters and declare the properties in it. I understood the principle but I am still lacking the idea to understand how I can handle for…
TechAffinate
  • 61
  • 1
  • 14