← Tools Home100% Client-Side

JSON to Java Record, Lombok & Jackson POJO Generator

Generate idiomatic Java Records, Lombok @Data classes, or standard Java POJOs with Jackson @JsonProperty annotations and type inference from JSON.

649 chars
Generated Java Classes
package com.example.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Instant;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;

public record Owner(
    @JsonProperty("user_id")
    Integer userId,

    @JsonProperty("full_name")
    String fullName,

    @JsonProperty("email_address")
    String emailAddress,

    @JsonProperty("verified")
    Boolean verified
) {}

public record Metric(
    @JsonProperty("metric_key")
    String metricKey,

    @JsonProperty("metric_value")
    Double metricValue,

    @JsonProperty("alert_threshold")
    Integer alertThreshold
) {}

public record ApiResponse(
    @JsonProperty("id")
    UUID id,

    @JsonProperty("name")
    String name,

    @JsonProperty("is_active")
    Boolean isActive,

    @JsonProperty("max_concurrency")
    Integer maxConcurrency,

    @JsonProperty("service_fee")
    Double serviceFee,

    @JsonProperty("created_at")
    Instant createdAt,

    @JsonProperty("deployment_date")
    LocalDate deploymentDate,

    @JsonProperty("tags")
    List<String> tags,

    @JsonProperty("owner")
    Owner owner,

    @JsonProperty("metrics")
    List<Metric> metrics
) {}

Target Class Style

3

Generated Classes Count

17

Inferred Fields Count

1.2 KB

Technical Reference & Architecture Guide

JSON to Java Record, Lombok & Jackson POJO Generator — Reference Guide

Generate idiomatic Java Records, Lombok @Data classes, or standard Java POJOs with Jackson @JsonProperty annotations and type inference from JSON.

Key Parameters & Controls

targetStructureenum ('RECORD' | 'LOMBOK' | 'STANDARD_POJO')

Specifies the target class style: immutable Java 16+ Records, mutable/immutable Lombok annotated classes (@Data, @Builder, @Value), or classic JavaBeans with explicit getters/setters.

propertyNamingStrategyenum ('CAMEL_CASE' | 'SNAKE_CASE' | 'KEBAB_CASE' | 'EXACT')

Determines how JSON keys map to Java fields and whether Jackson annotations (@JsonProperty, @JsonNaming) are generated to bridge case differences.

inferNumbersAsenum ('PRIMITIVE_OR_BOXED' | 'BIG_DECIMAL' | 'STRICT_LONG')

Controls numeric inference heuristics, mapping floating points to Double or BigDecimal and integers to Integer, Long, or BigInteger.

includeJacksonAnnotationsboolean

When true, annotates generated fields and classes with Jackson annotations such as @JsonProperty, @JsonInclude(Include.NON_NULL), and @JsonIgnoreProperties(ignoreUnknown = true).

dateTimeLibraryenum ('JAVA_TIME' | 'LEGACY_UTIL_DATE' | 'STRING_ONLY')

Controls ISO-8601 date-time string inference, automatically mapping timestamps to java.time.Instant, java.time.OffsetDateTime, or java.time.LocalDate.

Pro Tips & Best Practices

Common Gotchas & Troubleshooting

Jackson fails to deserialize generated Java Record with 'Cannot construct instance of (no Creators, like default constructor, exist)'.

Ensure jackson-databind is at version 2.12 or newer. If running on Java 16+, ensure jackson-module-parameter-names is registered in your ObjectMapper or use Jackson 2.13+ which automatically handles record canonical constructors.

Lombok @Builder fails or ignores default values defined in generated POJO fields.

Add @Builder.Default to fields with initializers, or supply an explicit @NoArgsConstructor alongside @AllArgsConstructor so Jackson can instantiate the object via reflection or builder patterns without resetting field defaults.

Nested heterogeneous JSON arrays (mixed types) cause invalid generic definitions like List<Object>.

Define a polymorphic common interface or abstract base class annotated with Jackson's @JsonTypeInfo and @JsonSubTypes, or preprocess the JSON payload to enforce consistent object structures before POJO generation.

Frequently Asked Questions

▼

▼

▼

▼

Related Tools & Utilities

All Tools →