RepoPilotOpen in app →

joelittlejohn/jsonschema2pojo

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

Healthy

Healthy across the board

weakest axis
Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit 6d ago
  • 9 active contributors
  • Apache-2.0 licensed
Show all 6 evidence items →
  • CI configured
  • Tests present
  • Concentrated ownership — top contributor handles 67% of recent commits

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/joelittlejohn/jsonschema2pojo)](https://repopilot.app/r/joelittlejohn/jsonschema2pojo)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/joelittlejohn/jsonschema2pojo on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: joelittlejohn/jsonschema2pojo

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/joelittlejohn/jsonschema2pojo shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across the board

  • Last commit 6d ago
  • 9 active contributors
  • Apache-2.0 licensed
  • CI configured
  • Tests present
  • ⚠ Concentrated ownership — top contributor handles 67% of recent commits

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live joelittlejohn/jsonschema2pojo repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/joelittlejohn/jsonschema2pojo.

What it runs against: a local clone of joelittlejohn/jsonschema2pojo — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in joelittlejohn/jsonschema2pojo | Confirms the artifact applies here, not a fork | | 2 | License is still Apache-2.0 | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 36 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>joelittlejohn/jsonschema2pojo</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of joelittlejohn/jsonschema2pojo. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/joelittlejohn/jsonschema2pojo.git
#   cd jsonschema2pojo
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of joelittlejohn/jsonschema2pojo and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "joelittlejohn/jsonschema2pojo(\\.git)?\\b" \\
  && ok "origin remote is joelittlejohn/jsonschema2pojo" \\
  || miss "origin remote is not joelittlejohn/jsonschema2pojo (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
  && ok "license is Apache-2.0" \\
  || miss "license drift — was Apache-2.0 at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jsonschema2Pojo.java" \\
  && ok "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jsonschema2Pojo.java" \\
  || miss "missing critical file: jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jsonschema2Pojo.java"
test -f "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java" \\
  && ok "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java" \\
  || miss "missing critical file: jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java"
test -f "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java" \\
  && ok "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java" \\
  || miss "missing critical file: jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java"
test -f "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java" \\
  && ok "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java" \\
  || miss "missing critical file: jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java"
test -f "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java" \\
  && ok "jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java" \\
  || miss "missing critical file: jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 36 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~6d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/joelittlejohn/jsonschema2pojo"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

jsonschema2pojo is a code generation tool that transforms JSON Schema definitions (or example JSON) into fully-annotated Java POJO classes with Jackson 2.x/3.x or Gson data-binding annotations. It eliminates manual boilerplate by automatically generating typed Java classes from schema specifications, making deserialization and serialization seamless. Maven multi-module monorepo: jsonschema2pojo-core (org.jsonschema2pojo base generation engine at ~1.2M LOC with AbstractAnnotator, AnnotationStyle, rule-based generation) and jsonschema2pojo-cli (CLI wrapper at jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli with Arguments.java, ClassConverter.java entry points). Separate maven-plugin and gradle-plugin modules exist for IDE integration.

👥Who it's for

Backend Java developers building REST APIs, data pipeline systems, or services that consume external JSON APIs; they use jsonschema2pojo to avoid hand-writing POJOs and keep them synchronized with evolving JSON schemas via Maven/Gradle plugins or CLI invocation.

🌱Maturity & risk

Production-ready and actively maintained. The project shows 1.2M+ lines of Java code, organized CI/CD pipelines (GitHub Actions), comprehensive test coverage in both core and CLI modules, and recent activity through Maven Central releases (v1.3.3). However, single-maintainer (joelittlejohn) with no recent high-velocity commits suggests stable/maintenance mode rather than rapid feature development.

Low risk for stable use cases: well-established library with Maven Central distribution and long history. Main risks are single-maintainer dependency handling (PR/issue response time), potential slowness with very large schemas (code generation is CPU-bound), and tight coupling to Jackson/Gson versions—ensure your project's Jackson version matches the annotator expectations.

Active areas of work

Project is in active maintenance: version 1.3.4-SNAPSHOT indicates recent development, dependabot.yml shows automated dependency updates, and GitHub Actions workflows (android-ci.yml, ci.yml) validate builds. No visible major feature development, but steady bug fixes and annotation compatibility updates.

🚀Get running

Clone and build with Maven: git clone https://github.com/joelittlejohn/jsonschema2pojo.git && cd jsonschema2pojo && mvn clean install. Verify CLI works: jsonschema2pojo-cli/target/classes/org/jsonschema2pojo/cli/Jsonschema2PojoCLI.java or use brew install jsonschema2pojo on macOS for pre-built binary.

Daily commands: Build jars: mvn clean package. Run CLI: java -jar jsonschema2pojo-cli/target/jsonschema2pojo-cli-1.3.4-SNAPSHOT.jar -s <schema.json> -t <target-package> -o <output-dir>. Maven plugin: add to pom.xml with <goal>generate</goal>. Gradle: apply id 'org.jsonschema2pojo' plugin and configure jsonSchema2Pojo { targetPackage = 'com.example' }.

🗺️Map of the codebase

  • jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jsonschema2Pojo.java — Main entry point orchestrating the schema-to-Java code generation pipeline; all contributors must understand the core workflow here.
  • jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java — Maps JSON Schema objects to JCodeModel AST nodes; critical for understanding how schemas are transformed into Java classes.
  • jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java — Defines how JSON objects are converted to Java POJOs; essential rule for object property handling.
  • jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java — Configuration interface controlling code generation behavior (annotations, builders, validation); fundamental for customization.
  • jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java — Abstract interface for annotation strategies (Jackson, Gson, JSON-B); critical abstraction for multi-framework support.
  • jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/Jsonschema2PojoCLI.java — Command-line interface entry point; shows how to invoke the core generator from the CLI module.
  • jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/ContentResolver.java — Resolves external schema references and handles content loading; critical for multi-file schema support.

🛠️How to make changes

Add support for a new annotation framework

  1. Create new annotator class extending AbstractAnnotator or AbstractTypeInfoAwareAnnotator (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/[YourFramework]Annotator.java)
  2. Register the annotator in AnnotationStyle enum with a new style constant (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AnnotationStyle.java)
  3. Update AnnotatorFactory.getAnnotator() to return your new annotator for the matching style (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AnnotatorFactory.java)
  4. Implement annotation methods: propertyField(), propertyGetter(), etc. to add framework-specific annotations (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/[YourFramework]Annotator.java)

Add a new JSON Schema constraint rule

  1. Create a new Rule class in the rules directory implementing Rule<Type, Type> interface (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/[NewConstraint]Rule.java)
  2. Implement the apply() method to validate and apply your constraint to the schema object (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/[NewConstraint]Rule.java)
  3. Register the rule in SchemaMapper by adding it to the rule chain/factory for the appropriate schema type (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java)
  4. Add test cases to verify constraint is properly applied to generated code (jsonschema2pojo-core/src/test/java/org/jsonschema2pojo/rules/[NewConstraint]RuleTest.java)

Extend the generator with custom Java name transformation logic

  1. Create custom handler implementing NameGenerator interface or extending JavaNameRule (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/JavaNameRule.java)
  2. Configure it in GenerationConfig via nameGenerator property or override in DefaultGenerationConfig (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java)
  3. The custom name generator will be invoked for property names, class names, and enum values during transformation (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java)

Support a new input schema format

  1. Add new format type to SourceType enum (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SourceType.java)
  2. Extend ContentResolver to handle parsing/normalization of your format to standard JSON Schema (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/ContentResolver.java)
  3. The rest of the pipeline (SchemaMapper, rules) processes the normalized schema without changes (jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/SchemaMapper.java)

🪤Traps & gotchas

No significant hidden traps, but note: (1) Large schemas may generate large Java files (no automatic splitting), (2) Properties with reserved Java keywords are escaped but can cause naming surprises, (3) JSON examples used as schema may lack type constraints—schema-first is more predictable, (4) Jackson/Gson versions must match annotator expectations or generated annotations won't work at runtime.

🏗️Architecture

💡Concepts to learn

  • JSON Schema Traversal & Visitor Pattern — jsonschema2pojo walks the JSON Schema AST and applies rules/annotations at each node—understanding this traversal model is essential for extending generation logic or debugging why certain schema properties are or aren't generating expected code
  • Annotation-Driven Code Generation — The core strategy: schema → intermediate representation → annotated Java source using AbstractAnnotator plugins; this pattern allows swapping Jackson/Gson/future frameworks without rewriting generation logic
  • Freemarker Templating — jsonschema2pojo likely uses Freemarker (or similar templating) to emit Java source code; understanding template variables and conditionals helps when customizing generated class structure
  • Data Binding Serialization Annotations — Jackson @JsonProperty, @JsonIgnore, @JsonDeserialize and Gson @SerializedName are the core output; knowing what each annotation does at runtime ensures generated code actually deserializes your JSON correctly
  • Schema Composition (allOf, oneOf, anyOf) — Modern JSON Schemas use composition; jsonschema2pojo must handle merging inherited properties and generating correct annotations—this is a complexity hotspot and common source of subtle bugs
  • Maven Plugin Development (Mojo) — The Maven plugin variant is a Mojo (Maven plain Old Java Object); understanding Mojo annotations (@Mojo, @Parameter) is needed to extend Maven-specific configuration or debug plugin execution
  • FasterXML/jackson-databind — Primary annotation target library; jsonschema2pojo generates Jackson annotations and depends on jackson-databind for serialization testing
  • google/gson — Alternative annotation target; jsonschema2pojo can generate Gson @SerializedName and other Gson-specific annotations
  • java-json-tools/json-schema-validator — Complementary library for validating JSON against schemas at runtime; often used alongside generated POJOs to enforce constraints
  • quicktype/quicktype — Alternative code generation tool supporting multiple languages (Python, TypeScript, Go, C#, Java); overlaps with jsonschema2pojo for Java but targets polyglot teams
  • joelittlejohn/jsonschema2pojo-gradle-plugin — Official Gradle plugin wrapper around core generation engine; enables Gradle-native build integration as alternative to Maven

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive integration tests for Jackson3Annotator

Jackson 3.x support was recently added (Jackson3Annotator.java exists), but there are likely no corresponding integration tests. This is critical because Jackson 3.x has breaking changes from 2.x. New contributors can add tests to jsonschema2pojo-core/src/test to verify Jackson 3.x code generation works correctly for common scenarios (serialization, deserialization, annotations).

  • [ ] Review existing Jackson/Jackson2 tests in jsonschema2pojo-core/src/test/java
  • [ ] Create JsonSchema2PojoGeneratorTest or similar for Jackson3Annotator
  • [ ] Add test cases for @JsonProperty, @JsonInclude, @JsonCreator with Jackson 3.x
  • [ ] Verify generated code compiles against Jackson 3.x dependencies

Add integration tests for Moshi1Annotator and Jsonb2Annotator

Moshi1Annotator.java and Jsonb2Annotator.java exist but are likely under-tested compared to Jackson. These are alternative data-binding frameworks that should have dedicated integration test suites. This helps ensure code generation for non-Jackson frameworks is reliable.

  • [ ] Create test directory structure: jsonschema2pojo-core/src/test/java/org/jsonschema2pojo/integration/
  • [ ] Add MoshiIntegrationTest and JsonB2IntegrationTest classes
  • [ ] Include round-trip serialization/deserialization tests for both frameworks
  • [ ] Test edge cases like nested objects, arrays, and optional fields

Add unit tests for CLI Arguments class and configuration validation

The Arguments.java class (jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/Arguments.java) parses command-line arguments, but ArgumentsTest.java likely has gaps in coverage. Add tests for argument validation, conflicting options, and edge cases to prevent CLI regressions.

  • [ ] Review current ArgumentsTest.java coverage
  • [ ] Add tests for invalid/conflicting configuration combinations (e.g., incompatible AnnotationStyle values)
  • [ ] Add tests for file path validation and URL handling in UrlConverter
  • [ ] Add tests for missing required arguments and default value initialization

🌿Good first issues

  • Add comprehensive integration tests for jsonschema2pojo-core/src/test covering edge cases like recursive schema references, deeply nested objects, and allOf/oneOf/anyOf composition—currently test coverage appears lighter in core than CLI
  • Document the AbstractAnnotator/AnnotationStyle plugin architecture with a concrete example (e.g., adding a hypothetical 'Moshi' annotator) in a new PLUGIN_DEVELOPMENT.md, with code examples from jackson2-annotator
  • Add validation in jsonschema2pojo-cli/Arguments.java to reject invalid output-directory paths early with helpful error messages, currently validation may fail silently during code generation

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 1c6b766 — Merge pull request #1780 from joelittlejohn/remove-readtree-url (joelittlejohn)
  • 6abe86b — Remove use of deprecated ObjectMapper::readTree(URL) (joelittlejohn)
  • de91f3d — Merge pull request #1670 from sigpwned/bug/1669/validation-annotations-minlength-and-maxlength-not-being-generated-for-a (joelittlejohn)
  • dccc64f — Fix missing @Size annotations on arrays (sigpwned)
  • a31723a — Merge pull request #1778 from joelittlejohn/fix-type-use-annotation-position (joelittlejohn)
  • 3f8b8ea — Fix JLS 9.7.4 type-use annotation placement (joelittlejohn)
  • 4ab9bbd — Only build gradle javadoc and maven site during release (joelittlejohn)
  • fe0d66d — [release] Update CHANGELOG.md and CONTRIBUTORS.md for 1.3.3 (joelittlejohn)
  • 5a046a9 — Merge pull request #1777 from unkish/issues/fix_ismap_check_in_validrule (joelittlejohn)
  • 9b61390 — Fix ValidRule::isMap check (unkish)

🔒Security observations

The jsonschema2pojo codebase appears to be a mature, well-structured Maven-based project. No critical vulnerabilities were identified from the visible configuration. Minor concerns include incomplete POM configuration visibility, resource filtering security, and the need for comprehensive dependency scanning. The project should implement input validation for the CLI tool to prevent potential code generation attacks. Overall security posture is reasonable for an open-source code generation tool, but dependency management and input validation practices should be verified.

  • Medium · Incomplete Maven POM Configuration — jsonschema2pojo-cli/pom.xml. The provided pom.xml snippet shows incomplete JAR plugin configuration. The manifest configuration appears truncated with 'addClasspath>true<' unclosed. This could lead to missing or misconfigured manifest attributes, potentially affecting the integrity of the generated JAR. Fix: Ensure the maven-jar-plugin configuration is complete with proper closing tags and all necessary manifest entries (Main-Class, Implementation-Version, etc.).
  • Medium · Resource Filtering Configuration Risk — jsonschema2pojo-cli/pom.xml - maven-resources-plugin configuration. The pom.xml uses custom delimiters (${*}) for Maven resource filtering to handle '@' characters in .bat files. This custom configuration could introduce unexpected variable substitution behavior if sensitive data is present in properties files. Fix: Review the scope of resource filtering and ensure no sensitive data (API keys, credentials) is included in filtered resources. Consider using a separate non-filtered resources directory for sensitive configuration.
  • Low · Snapshot Version in Use — jsonschema2pojo-cli/pom.xml - version declaration. The project version is set to '1.3.4-SNAPSHOT', indicating development/snapshot build. SNAPSHOT versions should not be used in production releases as they can change unpredictably. Fix: Ensure SNAPSHOT versions are only used during development. Release builds should use stable version numbers without the -SNAPSHOT suffix.
  • Low · Missing Dependency Information — jsonschema2pojo-cli/pom.xml - dependencies section not shown. The provided pom.xml snippet is incomplete and does not show the full dependency list. Without visibility into all transitive dependencies, potential vulnerable dependencies could be missed. Fix: Run 'mvn dependency:tree' and 'mvn dependency:check-update' to identify outdated or vulnerable dependencies. Use tools like OWASP Dependency-Check Maven plugin for vulnerability scanning.
  • Low · CLI Tool Security Considerations — jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/. The project includes a command-line tool (jsonschema2pojo-cli) that processes user-provided JSON schemas and generates code. If the tool processes untrusted schemas, there could be code injection or denial-of-service risks. Fix: Implement input validation for schemas, limit schema complexity (depth, size), implement timeouts for code generation, and validate generated code before execution.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · joelittlejohn/jsonschema2pojo — RepoPilot