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

Add a comment in the beginning of a class when using jsonschema2pojo or com.sun.codemodel

I'm trying to create POJOs using jsonSchema. I've found a project called jsonschema2pojo which seems suitable except for a couple of issues. I'm willing to fork the project and add some customizations (such as custom annotations and perhaps…
Slava
  • 160
  • 2
  • 11
0
votes
1 answer

How to generate classes with duplicate name in separate packages using jsonschema2pojo?

I am using jsonschema2pojo-maven-plugin (0.4.19) to generate Java classes from JSON files. I have 2 JSON files which have same field "xyz" with different attributes. So once I generate the "xyz" class from the 2nd JSON file, it replaces the first…
Ankur Jalan
  • 1
  • 1
  • 6
0
votes
1 answer

Mongo JSON to Java POJO mapping

I have a json object which looks something like this "price": { "sale": { "value": 39.99, "label": "Now" }, "regular": { "value": 69.5, "label": "Orig." }, …
user641887
  • 1,506
  • 3
  • 32
  • 50
0
votes
1 answer

Converting enum of variable length values using jsonschema2pojo

I am trying to create a json schema for a corresponding Java enum of variable length values. Information follows : JSON tried : "Info": { "type": "string", "enum": [ "TITLE", "ADDRESS", "NAME"; ] …
Naman
  • 27,789
  • 26
  • 218
  • 353
0
votes
1 answer

Right POJO Model

How I can create right POJO Model for my needs?I want to deal with response for one web server.Result is https://api.vid.me/videos/featured But its very big,I just need title,number of likes and url of video,how can I do it correct to right woring…
rost_proz
  • 47
  • 1
  • 1
  • 7
0
votes
1 answer

How to do json mapping on multiple json object with same key

I've been trying to use GSON and JsonScheme2Pojo to map my json object. So far I've created this class. public class MPayTransaction { @SerializedName("mp_request_type") @Expose private String…
Azizi Musa
  • 1,009
  • 2
  • 10
  • 31
0
votes
1 answer

Model issue using jsonschema2pojo

I have started to use retrofit to work with json, using jsonschema2pojo to generate my models. But i faced a problem that one field in Json can be array as well as object. Can somebody give me advise how to solve this?
0
votes
2 answers

jsonschema2pojo make generated class implement Serializable interface

How can I force the jsonschema2pojo generated class to implement serializable interface? I am parsing plain json and not JSON Schema so making the json contain "javaInterfaces" array is out of the question. Here is the working code: JCodeModel…
Oleksiy Martynov
  • 379
  • 2
  • 11
0
votes
1 answer

jsonschema2pojo-cli-0.4.13 dead in the water?

I'd like to create POJOs from a reasonably complex JSON schema that references types within itself, and the web interface has known issues doing this that are apparently fixed for offline use. I'm running on Win7, and the output from java -version…
Craig Graham
  • 1,161
  • 11
  • 35
0
votes
1 answer

JSON to POJO conversion error for different types of values

While converting JSON data to POJO using Gson I get this error. com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 119 My JSON is : { "success":true, …
smya.dsh
  • 651
  • 5
  • 10
  • 23
0
votes
1 answer

JSON schema using javaType from a separate module in the project

How do you use a type that is declared in a separate module of the same project? I have the following JSON schema: "firstname" : { "type" : "object", "javaType" : "location.of.class.Name" } Where the type is declared in a class in my rs…
Casper
  • 31
  • 9
0
votes
1 answer

JsonSchema2pojo doesnot generate POJO

I was given a pojo like below, { "id": "yyy", "$schema": "http://json-schema.org/draft-04/schema#", "packages": { "id": "#/packages", "description": "XXX", "type": "object", "properties": { "xx": { …
Sara
  • 33
  • 1
  • 10
0
votes
1 answer

json schema containing multiple independent types

Is there any example to show how a json schema can be written to include multiple independent objects in one file? If its possible, is there any java library that can convert all of them to individual pojos and vice versa?
l a s
  • 3,836
  • 10
  • 42
  • 61
0
votes
3 answers

Generate Multiple POJO's from single json schema file

I am using jsonschema2pojo to generate POJO's. Its working fine. But I want to generate multiple POJO's from single json schema file. Is this possible using jsonschema2pojo plugin. One way to generate multiple POJO's is to provide multiple json…
Bhushan
  • 123
  • 11
0
votes
1 answer

jsonschema2pojo Regenerating JavaType Issue

I am working with jsonschema2pojo and now dealing with more complex java types within. I have come across an issue when it comes to regenerating a recently generated class. Example, my definitions has the followed defined: "definitions" : { …
lemoncolly
  • 13
  • 5
1 2 3
11
12