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

jsonchema2pojo: How the minLength, maxLength bounds applied on generated Java Pojo class?

I want to know, how the bounds provided in JSON schema gets transformed in to java POJO class? For example, below is definitions.json file contents - { "definitions": { "address": { "type": "object", "properties": { …
Gunwant
  • 949
  • 1
  • 14
  • 29
0
votes
1 answer

How to map Json object to pojo, if JSON has duplicate keys in object

Below is the example of JSON object. { "primaryAccountNumber":"4353453", "processingCode":"3453", "transactionAmount":"34534", "transmissionDateTime":"34534", "receiptsFields":{ "line":"BHN VALIDATION - DAR", …
0
votes
0 answers

referencing json schema element from another json schema

I want to reference specific field of second schema in first schema through $ref keyword . secondSchema.json file: { "store":{ "book":[ { "category":"A", "author":"AAAAAA", "title":"A Book", …
0
votes
2 answers

Unable to use POJO class to get the token and save into a string

I am getting the data from the API and then I am converting it to the String so that I can use my POJO classes(User and Token) to save the data into sharedPref. I am able to use the methods of User class but whenever I try to access the method of…
MukulCode
  • 97
  • 11
0
votes
1 answer

How parse JSON and set as Object Model

I have an API with 2 different response: response OK { "name": "test" } response KO [ { "name_1": "test", "name_2": "test" } ] the problem is that using Retrofit, normally, I use a model to parse results but response KO has…
Carlos
  • 97
  • 1
  • 10
0
votes
1 answer

Using the jsonschema2pojo's generated Class instantly to create objects in the code

I want to automatically generate classes form various receiving API json replies. Then, generate objects inside the code using these classes have been made already. I'm utilizing jsonschema2pojo library. With the example code I tried, The library…
DummyBeginner
  • 411
  • 10
  • 34
0
votes
1 answer

RestAssured, POJO and dealing with lists

I'm writing a test for an API and at one endpoint I get JOSN in response with couple arrays into one array. Can I make POJO class which mapping those array/arrays into a class object? for example, JSON in response looks like this: { "total":…
vmaric
  • 369
  • 1
  • 4
  • 14
0
votes
0 answers

Having null response for a list inside a class object 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
0
votes
0 answers

jsonschema2pojo generating all variable of type object but not the data type i provide

I am new to this API. Trying to generate a class of 10-15 fields of different data type. But generated class has the 1st variable of the type I declared but remaining if type Object as below. // Schema { "type":"object", "properties": { …
Geek
  • 3,187
  • 15
  • 70
  • 115
0
votes
1 answer

How to create POJO class with different structure JSON Object

Here is my json schema [ { "title": "Taman Lansia", "alamat": "Jl. Cisangkuy, Citarum, Bandung Wetan, Kota Bandung, Jawa Barat 40123", "image": "Link image", "status": 1 }, { "title": "Fasilitas Taman_Lansia", "fasilitas": [ { …
0
votes
3 answers

How do i fetch data as a List from json using Retrofit

Single data are fetched but when i try to fetch as a List it's shown the problem Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ here is the JSON link:…
Imran Sk
  • 303
  • 5
  • 17
0
votes
1 answer

IllegalArgumentException using resource ref in json schema

I'm having a maven project with some json schemas organzied into folders like this: src/main/resources/schema/json/modules/moduleA/typesA.json src/main/resources/schema/json/modules/moduleA/typeA.json So both schemas are located in the same…
merlin-hst
  • 61
  • 1
  • 4
0
votes
0 answers

How to exclude fields in equals and hashcode from jsonSchema2Pojo generated files in java

"Below is json schema to generate a java file and my requirement is to exclude pageIndex, resolutionList and fieldsToBeHighlighted fields from equals and hashcode json generated code. I have tried to add excludedFromEqualsAndHashCode field in schema…
0
votes
1 answer

parsing the array, in which there are arrays of objects

It might be too easy but I just cannot find a solution to this. How can I parse the array, in which there are arrays of objects? This is my example Json { "status":"Ok", "items":[ [ "1530871200000", { …
Mich
  • 71
  • 13
0
votes
3 answers

make json to pojo from an array without index

I'm using retrofit and I have a contact class like this : public class MyContact { private String response; private String message; private Map additionalProperties = new HashMap(); public String…
Hadi Ahmadi
  • 129
  • 12