jsonschema2pojo

GitHub

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc

RAW Doc

CHANGELOG

Changelog

1.3.3


* Support type-use annotations for map value validation (Map<String, @Valid T>) (#1774)
* Ignore null values when generating item type from array examples (#1772)
* Support type-use annotations for array item validation (List<@Valid T>) (#1771)

1.3.2


* Could not apply requested plugin error when using version 1.3.1 of Gradle plugin 'org.jsonschema2pojo' (#1769)

1.3.1


* Add plexus-utils dependency, as this is no longer provided in Maven 3.9 (#1751)

1.3.0


* Migrate publishing from legacy OSSRH to Maven Central Portal (#1747)
* Remove Ant task (no longer supported) (#1743)
* Require JDK 17 (#1741)
* Add Jackson 3 annotation support (#1740)
* Prevent StackOverflowError when root is self-referencing (#1679)
* Fix 'AbstractCompile.destinationDir property has been deprecated' error when using Gradle 8 (#1646)
* Fix problems with remote URL (e.g. http) when using Maven Plugin (#1614)
* Fix generics class warning when using generated base builder class (#1587)
* Allow URL(s) as source in jsonschema2pojo-gradle-plugin (#1554)

1.2.2


* Don't log ClassAlreadyExistsException for Enum (#1597)
* Prevent generating duplicate constructors when all properties are required; and both includeAllPropertiesConstructor and includeRequiredPropertiesConstructor are true (#1553)
* Add support for property names containing question mark(s) (#1522)
* Avoid NPE when setting additionalProperties path (#1515)

1.2.1


* Fix detection of targetVersion for Android gradle builds (#1487)

1.2.0


* Avoid output to System.err when finding unique Enum name (#1485)
* Add useful debug logging when reading schemas and creating classes (#1483)
* Use targetVersion to decide which Generated annotation to add (#1482)
* Add Javadoc to constructors parameters for properties that have title/description/$comment (#1481)
* Choose default targetVersion using Gradle/Maven configuration (#1478)
* Use Mojo Annotations instead of Javadoc tags in the Maven Plugin (#1476)
* Add Email bean validation annotation for "format":"email" (#1475)
* Allow empty string and underscore as property name (#1468)
* Use Object as the type in case schema property contains mixed types (#1456)
* "Path not present" error when processing multiple JSON files having objects with the same name (#1427)

1.1.3


* Add command line option to print version (#1458)
* Accept multiple values provided with single "-s"/"--source" argument (#1457)
* Avoid deprecation warning with Gradle plugin re Gradle 8.0 and IncrementalTaskInputs (#1454)
* java.lang.OutOfMemoryError: Java heap space (#1423)
* Properties with special character in the name (#, /, etc) cause IllegalArgumentException 'Path not present' when using 1.1.2 (#1402)
* Add builder method to create a new instance of the builder (#1396)
* Added support for JSON-B (#1385)
* Get Stackoverflow error if array items schema contains trees/cycle dependencies for children (#1376)
* Publish Gradle plugin to plugins.gradle.org (#282)

1.1.2


* Use LinkedHashMap for additional properties, so the original ordering in the JSON is preserved (#1397)
* Collection fields are unnecessarily initialized to "null" (#1346)
* Enum not getting generated correctly with CamelCase values (#1310)
* Support using JSR-303 annotations from 'jakarta.validation' package (#1280)
* Item type for array property 'listFta' is incorrectly named ListFtum (#1275)
* Android Parcelable unused import (#1150)
* jsonschema2pojo website returns HTTP 500 for using TreeNode example in the wiki (#781)
* Recursive schema $ref generates an extra class (#368)

1.1.1


* nested sibling references causes error Path not present: definitions only on https://www.jsonschema2pojo.org/, local is fine (#1237)
* Provide a JDK9+ compatible annotations library for Android projects (#1218)
* $comment field for property can be turned into JavaDoc (#1197)
* UnnecessaryModifier PMD warning in generated code (private constructor for enums) (#1102)
* When providing example json with a value great than Integer/MAX\_VALUE, it should generate a long field in Java (#971)
* IllegalArgumentException while resolving reference to reference with # (#793)

1.1.0


* Add @Generated annotation to classes and includeGeneratedAnnotation config option (#1202)
* Remove Jackson 1.x support (#1200)
* Remove jsonschema2pojo-scalagen (#1199)
* Enum generation ignores existingJavaType (#1182)
* Require Gradle 5.6+ when using the Gradle plugin (and update examples) (#1131)
* formatTypeMapping fails with primitive types (#1126)
* Add private modifier to constructor-related configuration options so that they can be configured in the POM (#1118)
* Using enum + javaType (without package name) generates enum in default package as a class, then fails to compile (#1103)
* Fix raw type warnings when extending a builder (#1101)
* Recursive schemas with relative paths can generate the same class twice with "\_\_1" in the name (#1077)
* Gradle shows deprecation warnings regarding Gradle 7.0 (#1070)
* Add javax.annotation.processing.Generated for Java 9 (#835)

1.0.2


* Restrict JSR-303 annotations to supported field types (#1063)
* Add package when javaType is not a fully qualified name (#1054)
* Feature/format type mapping for array types (#1044)
* Implement javaEnums extension (#1041)
* Covariant return types on build() method (avoid having to cast after calling the build() method on a subclass) (#1014)
* Add support for @Digits JSR-303 annotation (#977)
* Add support for title and description on Enums (#975)
* Add support for including JsonTypeInfo Annotation (#967)

1.0.1


* Check schema required array before is required flag (#964)
* Features/builders as inner classes (#953)

1.0.0


* Don't register output directory as a set of files, since this breaks Gradle 5.0+ (#940)
* Builder method should be named consistently with getter/setter (#905)
* Objects inside array with name ending with "List" are generated as "SomeNameList" (#780)

1.0.0-beta1


* Add 'formatTypeMapping' config option to allow overriding types used for formats (#923)
* Modify Rule#apply signature to include parent node (allows context-aware rules) (#917)
* Add 'javaOptional' extension rule to allow individual fields to use Java Optional on getter (#913)
* Allow schema title to be used as class name (new useTitleAsClassname config option) (#908)
* Incorrect @Nullable JSR305 annotations generated when using 'required' array (#906)
* Ensure Optional on getters and JSR 305 annotations can be activated via Maven POM (#895)
* Remove 'includeAccessors' option and rely only on 'includeGetters'/'includeSetters', to avoid complex interaction of these options (#881)

1.0.0-alpha4


* maven-plugin broken due to typo in Jsonschema2PojoMojo Line 728: @parameter property contains dangling '}' (#880)

1.0.0-alpha3


* maven plugin output directory should default to "generated-sources/jsonschema2pojo" (#878)
* Always pass enclosing class or enum to annotator methods (changes method signatures) (#876)
* Remove plugin runtime dependency on Moshi (#874)
* Remove plugin runtime dependency on Android (#873)
* Drop support for Maven 2.x (#872)
* Move to Java 8 (#860)
* Generate Camel Case from underscore style names, see #848 (#850)
* Separate javaType into 'existingJavaType' and 'javaType' (#828)

1.0.0-alpha2


* Changed maven central repo listing id in poms to default of 'central' (#833)
* Fix incorrect logic between -da, -ds and -dg in CLI (#790)
* The generated POJO does not always adhere to JavaBean naming conventions (#756)
* Improve unique class naming strategy by appending an incrementing number instead of adding more and more underscores (#476)

1.0.0-alpha1


* Improve error message to include the bad type when javaType cannot be parsed (#823)
* Replace commons-lang equals, hashCode, and toString with generated code (#812)
* Add partial support for wildcards (? and ? extends...) in "javaType" declarations (#810)
* Normalize/canonicalize relative source paths (and remove extra underscore classes that appear when using a relative source path) (#792)
* Fix sourceType docs to include YAML/YAMLSCHEMA in Maven, Gradle and Ant (#787)
* Add useOptionalForGetters option for Java 8 java.util.Optional on getters (#344)
* Wrong class name when using $ref in json schema (#164)

0.5.1


* Add Scala and YAML to the website (#785)

0.5.0


* Fix inflector for 'taxes' -> 'tax' (#783)
* Support YAML syntax for JSON Schema (#778)
* Getters and Setters can now be activated independently (#759)
* Generate toString() without reflection (#753)
* Intelligent Gradle plugin up-to-date check (#748)
* Scala case classes support (#598)
* Make the fields used in hashcode and equals generation configurable (#530)

0.4.37


* Two default constructors incorrectly added when types are parcelable and includeConstructors is active (#742)

0.4.36


* Add customTimePattern and formatTimes config options (#740)
* Schema with required[""] results in String index out of range: 0 (#725)
* [Android] Writing to /Reading from Parcelable ignores superclass (#602)

0.4.35


* Add support for excluding fields from generated toString methods (#720)

0.4.34


* Add 'sourceSortOrder' to decide how source files are iterated (#719)

0.4.33


* Support customDatePattern and customDateTimePattern as global config options (#716)
* Support customPattern as an alias for customDatePattern and customDateTimePattern (#715)
* formatDateTimes default pattern should include timezone (#714)
* Fix compilation errors for non-string enums (#713)
* Add 'formatDates' config option to add JsonFormat annotation on format "date" fields (#699)

0.4.32


* org.jsonschema2pojo.ContentResolverTest require internet connection (#704)
* Add option to specify custom fragment path delimiters (#697)
* javaType doesn't work while setting classNamePrefix = "SomePrefix" (#650)

0.4.31


* List property called "status" has items with type "Statu" (#695)

0.4.30


* Cannot use custom date,time types from external dependencies in maven/ant plugins (#673)
* Jackson inclusion option (#671)
* Support URI format properties with a default value using URI.create (#664)
* Support configurable serialization inclusion for Jackson (#629)

0.4.29


* Fix include additional properties set incorrectly by CLI (#660)
* Remove useless and empty Javadoc (#659)
* @JsonPropertyDescription annotation does not properly extract description from schema (#655)
* Support @JsonFormat annotation for date-time fields (#643)

0.4.28


* Adding support for JSR-305 annotations (#645)
* additionalProperties getter method is missing @Valid annotation. (#503)
* Zip of binary distribution of CLI (#500)

0.4.27


* Add ["-", " ", "_"] as default propertyWordDelimiters for Gradle plugin (#625)
* Allow setting custom annotator and custom rule factory fields directly in Gradle (#617)
* Deep-merge array items in example JSONs before generating schemas (#423)
* Gradle plugin has no default propertyWordDelimiters (#162)

0.4.26


* Remove javax.annotation.Generated as it doesn't ship with Android (#577)

0.4.25


* Add option to use BigInteger for JSON integer type (#614)
* Supporting other primitives as backing types for enums (#612)
* Generate hashCode and equals even without declared fields (#611)
* Use unique enum constant names (#609)

0.4.24


* Support "required" keyword draft04 array-style when generating constuctors (#599)
* Add feature to allow comments in schema files (#589)
* javaType with generics does not apply correct imports when "type": "object" is omitted (#582)
* Add @JsonPropertyDescription when "description" property present (#571)
* Constructors are incompatible with extends keyword (#555)

0.4.23


* Force lower camel case fields when using JSON (#563)
* Fix broken embedded refs (#560)
* Added file extensions config parameter (#548)
* Overridden builders are not added to empty child class (#538)
* Wrong default value for BigDecimal (#535)
* Add Moshi 1.x annotation style (#529)
* Add serializable as an optional/configurable option (#404)

0.4.22


* Adding date-time types to Maven plugin mojo configuration (#531)
* Fix javaName breaking required properties (#528)
* Add support for using BigDecimal to represent numbers (#517)
* Jsonschema2pojoRule report problems to STDERR (#513)

0.4.21


* Fix NullPointerException in Gradle plugin for Java (non-Android) projects (#510)

0.4.20


* Regression: when a extending a schema with a redefinition of the same field, with methods should be generated only once (#507)
* Unnecessary @SuppressWarnings java warnings after upgrade (#498)
* Improved Android support via Gradle plugin (NOTE: Changes behaviour regarding output directory) (#495)

0.4.19


* Add javaName schema property (#499)
* Declare an enum without that "static" (#496)
* includeDynamicAccessors should default to false (don't include dynamic accessors by default) (#482)
* Inflector - incorrect for word "specimen" (#479)
* Allow JSON to be passed as a String to SchemaMapper (#475)
* Prefix / Suffix support when javaType is not specified (#465)

0.4.18


* Added support for custom date-time, date, time classes. (#469)
* Databases element of type array generated class name Databasis instead of Database (#461)

0.4.17


* Covariant builders - copy builder methods from superclass, with narrow return type (#455)
* Specify target JVM version (#454)
* Nested refs not resolved correctly when schema supplied as string (#446)
* Make Inflector more amenable to thread safety. (#435)
* Add Dynamic Accessors (#386)

0.4.16


* Use minimum and maximum value of an integer property to determine java type long (#434)
* Fix path to jar in windows script for the case it is run not from home dir (#432)
* Make the quick lookup map 'final' (#428)
* "extends" schema resolution assumes current schema is at root of file (#425)
* Recursive $ref failed (#250)

0.4.15


* $ref doesn't work when ref'ed message also has extends (#408)
* Support direct class inheritance with 'extendsJavaType', without using 'extends' (#402)
* additionalProperties java.util.Map is not generated by default when embedding this library and extending DefaultGenerationConfig (#398)
* If a schema sits inside a directory with a hyphen in its name, plugin will generate an invalid Java package name (#383)
* Allow get/set methods to be disabled, use public fields instead (#355)

0.4.14


* Fix 'Unable to load class org.jsonschema2pojo.NoopAnnotator' from Gradle plugin (#395)
* Library projects should use android.libraryVariants instead of android.applicationVariants (#391)
* Allow nullable type (instead of Object) when JSON type is an array with ["string", "null"] (#390)
* Allow custom names to be supplied when creating an enum (#385)
* Allow disabling additionalProperties generation with a global config option (#376)
* 'javaInterfaces' which contain generics produce syntactically incorrect imports (#317)

0.4.13


* RequiredArrayRule not working for properties with _ or -. (#377)
* Maven plugin shows sourcePaths error for includes/excludes when sourcePaths is not defined (#374)

0.4.12


* Didn't work in Android Studio with with current master branch '040e3ae' (#370)
* Use the correct ClassLoader in createFromParcel for lists (#356)
* Find jar when jsonschema2pojo sh script is not running in script folder (#351)
* Fix parameter description of --class-prefix and --class-suffix. (#350)
* Multiple enum array properties with same name cause JClassAlreadyExistsException (#349)
* Allow empty package names (#348)
* Corrected Exclude pattern behavior with Maven to avoid excluding all files (#340)

0.4.11


* Add super() to the equals/hashcode impl (#333)
* Use Gson @SerializedName annotation on ALL fields, even when JSON name matches Java name (#327)
* Adding support for required array from http://tools.ietf.org/html/draft-... (#325)
* default tag doesn't work for empty string (#320)
* EXPERIMENTAL Support Parcelable types for Android (#127)

0.4.10


* Initial class name is truncated after first . char, instead of last . char (#313)
* Add support for android library plugin (#305)
* Support "javaType" for things that are not "type": "object" (#223)

0.4.9


* Array types are ignored inside generics in javaType (#299)
* Add config options to generate Joda LocalDate and LocalTime (#298)
* Allow URLs as source locations (#293)

0.4.8


* Android support in gradle plugin (#292)
* Add support for Jackson's JsonView (#291)
* Added support for javaType on integer and number properties. (#287)
* Option to create constructors (with all fields, or with required fields) (#231)
* Support nested generic type arguments in javaType (#196)

0.4.7


* Adding UUID support to FormatRule (#270)
* Add GSON annotation '@SerializedName' to Enums (#267)
* Add ability to set prefixes/suffixes for generated classes (#258)

0.4.6


* ClassNotFoundException when attempting to use a custom annotator from a project dependency (#256)
* Inflector incorrectly singularizes Address to Addres (#244)
* propertyWordDelimiters config is ignored (#243)
* Improve the way Equals and Hashcode are generated (#241)
* Support for @JsonTypeInfo in generated classes using deserializationClassProperty (#235)

0.4.5


* Allow sets to have an empty default value (#232)
* Use LinkedHashSet when deserializing Set to preserve order (#227)
* Allow SchemaMapper to generate from String and not only URL (#221)
* Generate @Param and @Returns javadoc (#219)
* Creating a list of objects with class name as “S” (#213)
* Add 'customRuleFactory' config option for pluggable RuleFactory (#211)

0.4.4


* Added ')' to jdk unbounded range for Maven 2.X (#205)
* Allow Sets and Lists to be initialized to null (instead of an empty collection) (#203)

0.4.3


* Add includes & excludes Maven config options for source file filtering (#200)
* Reorganise module dependencies, pull CLI out from under other plugins (#198)
* "properties" property implies "type": "object" (#192)
* Preserve casing of field names (#187)
* sourceType = 'json' is ignored by Gradle plugin (#184)
* Handling local references on jsonschema2pojo.org (#183)

0.4.2


* Builder Method for Additional Properties (#175)
* javaInterfaces extension property is ignored for Enum types (#172)
* Binary property support (#171)
* Support annotating additionalProperties field. (#170)
* customAnnotator shows 'dynamic properties deprecated' warning when using Gradle plugin (#163)

0.4.1


* Switch from HashSet to LinkedHashSet for uniqueItems arrays to preserve order (#159)
* Add @Valid on all collections, not just those with items type "object" (#158)
* Allow collections to be null by default (#156)
* Add support for generic type arguments to javaType (#151)
* sourceType config option is ignored by the gradle plugin (#144)
* Array properties that include the word "men" in the name result in incorrectly named item class (#142)
* Type "Number" is generating Floats instead of Double (#141)
* Add config option to choose commons-lang3 for hashCode/toString implementation (#140)
* Return JType from SchemaMapper.generate(...) (#137)

0.4.0


* Rename setAdditionalProperties to avoid confusing naive introspectors (#136)
* ExtendedCharacters tests fail on command line, but pass in Eclipse (Windows) (#131)
* Long integers become java.lang.Double when using JSON source type (#130)
* Integration tests in GsonIT suite fail on Windows (#129)
* JSON schema with enum member with a name starting with a capital letter, causes a generation of a code that doesn't compile (#126)
* Contribute Gradle plugin (#123)
* Corrected default annotationStyle to be jackson2 (#122)
* Enable maven plugin to recurse subdirectories for schema to code generation (#117)
* Migrate groupId to org.jsonschema2pojo (#116)
* Migrate package structure to org.jsonschema2pojo (#115)
* Allow system default charset to be overriden (#113)
* Configuration option to use Joda types (#110)
* Default propertyWordDelimiters to commonly used characters (#109)

0.3.7


* Standalone enums have wrong package name (#103)
* Type names are printed to stdout during code generation (#101)
* @Valid is not being added to an arrays of objects that are defined using a $ref (#97)
* ContentResolver.resolve throws a.lang.IllegalArgumentException: Unrecognised URI when path to schema contains space (#94)
* Add 'removeOldOutput' option to clear all previously generated sources (#92)
* Add support for generating Gson compatible types (#70)
* Add extension to force generated classes to implement additional interface(s) (#60)

0.3.6


* Better inflection when making array names singular (#96)
* Optimized deserialization for enum values (#95)
* Elements with similar names are overwritten (#93)
* Support for classpath in Ant target (#89)
* Support for custom Annotator classes (#86)

0.3.5


* Add support for http:// URLs when using $ref (#87)
* Add support for resource: URLs when using $ref (#85)
* JSON property called "class" creates a method called "getClass" which Java is not happy about (#84)

0.3.4


* Support @Valid annotation for transitive validation (#82)
* Add minLength/maxLength to JSR-303 support (#78)
* Array properties use item type instead of collection type when using a ref to an array schema more than once (#76)
* Array item type is not named well when array property name ends in 'ies' (#75)
* Run a hosted/web version of jsonschema2pojo (#66)

0.3.3


* Configuration propertyWordDelimiters are used for properties but ignored when naming new Java types (#73)
* Reserved Java words are not transformed during object generation when propertyWordDelimiters=_ is used (#72)
* Threadsafe Maven generate mojo (#71)
* Support generating types 'by example', using example JSON document instead of a JSON Schema (#42)

0.3.2


* Switch from commons-jci snapshot to jsr-199 compiler for integration tests (#68)
* Support both Jackson 1.x and Jackson 2.x (#64)
* Property name that is a java keyword generates java code with compile error (#63)
* Some tests fail on Windows due to line.separator differences (#56)
* Support for JSR-303 validation annotations (#18)

0.3.1


* Add support for multiple source files/directories (#62)
* Default null value causes NumberFormatException (#61)
* Compile error when schema contains list with empty default value (#59)
* Exception thrown for empty string enum value. (#58)
* Add flag not to generate hashCode() and equals() to Maven plugin (#53)
* Add flag to Maven plugin that allows Jackson annotations to be omitted (#52)
* No source file in exception from parse error (#50)

0.3.0


* Switch from Easymock to Mockito (#49)
* IllegalArgumentException when using hyphen as a delimiter in the CLI (#47)
* Remove Serializable from POJOs since they aren't (necessarily) (#45)
* Migrate to Jackson 2.0 (#44)
* Support for union types (#17)

0.2.3


* Null pointer when invoking the maven plugin if propertyWordDelimiters not set (#46)

0.2.2


* Add support for primitive types via the javaType property (#41)
* generation yields unreproducible results for "additionalProperties" (#40)
* Option for generating CamelCase names (#39)

0.2.1


* Add 'skip' property to allow maven plugin to be easily switched off (#37)
* Keep wiki example in line with code automatically (#35)
* Add Eclipse m2e support (#34)
* Ant task(s) for jsonschema2pojo (#23)

0.2.0


* Migrate to git (#33)
* Remove deprecated 'optional' rule (#32)
* Properties should be nullable, use wrapper types not primitives (#31)

0.1.10


* omitting targetPackage causes NullPointerException in maven plugin (#30)
* Improve serialization ordering (#27)

0.1.9


* Omit null valued properties when deserializing POJOs (#29)
* Publish maven plugin documentation (#26)
* Make the addition of output dir as a source root optional (#25)
* Plugin does not respect types present on the project classpath (#24)

0.1.8


* Add support for more format values (#21)
* Pom files cause plugin version warnings in Maven 3 (#20)
* Support for 'extends' schema rule (#14)

0.1.7


* Copyright notices are currently out-of-date (#19)
* Support for 'default' schema rule (#15)
* Add acceptance test framework for better end-to-end testing (#10)
* Create empty collection when mapping JSON array to Java List/Set (#3)

0.1.6


* Properties with special characters in name are not marshalled/unmarshalled correctly (#13)
* Format rule only applies to strings, spec says it is valid for any type (#12)
* Type rule does not default to "any" or accept unrecognised types as per spec (#11)
* Support for $ref (#7)

0.1.5


* Jackson Enum annotations aren't applied correctly (#9)
* Publish versioned javadocs & remove head javadocs from repo (#6)

0.1.4


* Schema with non-complex type as root element produces extra/invalid pojos (#8)

0.1.3


* Support additionalProperties from json schema (#5)

0.1.2


* Create builder-style pojos (#2)

0.1.1


* Automate all release tasks (#48)

0.1.0

---

CONTRIBUTING

1. Use a feature branch

Feature branches make pull requests easier as GitHub will keep your pull request up-to-date when the feature branch changes. If you need to rebase to fix some things after creating your pull request, or if you end up having multiple pull requests open at the same time, having a pull request associated with a branch instead of master will make your job easier.

2. Run the test suite

jsonschema2pojo includes both unit and integration tests. The unit test coverage is not high, instead we rely on an exhaustive set of integration tests that cover all the code generation features using example schema documents.

To compile, unit test, package, and run the integration test suite (the typical full build), use:

./mvnw clean verify

3. Add integration tests

When contributing, you may often find unit tests (and TDD) helpful and you're free to add unit tests. If you're adding/amending code generation features then integration tests (end-to-end tests that use an example schema to generate and compile Java code) are essential. We can't merge pull requests unless they have integration tests, since without tests your feature could be lost in a future release.

4. Rebase and keep a clean log

Rebase against master often, if your pull request is stale it can't be merged. Rebase your commits into logical chunks, without errors (multiple commits are okay, but squash minor commits that fix errors in earlier commits). Force-push to your feature branch after you have rebased.

---

README

jsonschema2pojo [](https://github.com/joelittlejohn/jsonschema2pojo/actions/workflows/ci.yml?query=branch%3Amaster) [](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jsonschema2pojo%22)

_jsonschema2pojo_ generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x, Jackson 3.x, or Gson.

Try jsonschema2pojo online<br>or brew install jsonschema2pojo

You can use jsonschema2pojo as a Maven plugin, a command line utility, a Gradle plugin or embedded within your own Java app. The Getting Started guide will show you how.

A very simple Maven example:

xml
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<targetPackage>com.example.types</targetPackage>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>

A very simple Gradle example:

groovy
plugins {
id "java"
id "org.jsonschema2pojo" version "1.3.3"
}

repositories {
mavenCentral()
}

jsonSchema2Pojo {
targetPackage = 'com.example'
}

Useful pages:
* Getting started
* How to contribute
* Reference
* Latest Javadocs
* Documentation for the Maven plugin
* Documentation for the Gradle plugin

Project resources:
* Downloads
* Mailing list

Special thanks:
* unkish
* Thach Hoang
* Dan Cruver
* Ben Manes
* Sam Duke
* Duane Zamrok
* Christian Trimble
* YourKit, who support this project through a free license for the YourKit Java Profiler.

Licensed under the Apache License, Version 2.0.

---