JSON to Java Record / POJO Converter
Convert JSON objects into modern, immutable Java 17+ records or traditional Lombok/Jackson POJOs with automatic type inference and snake_case mapping.
package com.example.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/**
* Autogenerated by Veltoryx Developer Tools (https://veltoryxtech.com/tools/json-to-java).
* Client-side generated; safe for Spring Boot controllers and Jackson serialization.
*/
public record OrderPayload(
@JsonProperty("order_id") Long orderId,
@JsonProperty("customer_id") String customerId,
@JsonProperty("status") String status,
@JsonProperty("total_amount") Double totalAmount,
@JsonProperty("items") List<Item> items,
@JsonProperty("shipping_address") ShippingAddress shippingAddress,
@JsonProperty("is_priority_shipping") Boolean isPriorityShipping
) {
public record Item(
@JsonProperty("sku") String sku,
@JsonProperty("quantity") Integer quantity,
@JsonProperty("unit_price") Double unitPrice
) {}
public record ShippingAddress(
@JsonProperty("street") String street,
@JsonProperty("city") String city,
@JsonProperty("postal_code") String postalCode,
@JsonProperty("country") String country
) {}
}How to use this tool
Paste your raw JSON payload into the input editor, or click 'Load Sample' to explore an example.
Select Java 17+ Record or Class (POJO), toggle Jackson annotations, Lombok, and snake_case to camelCase conversion.
Click 'Copy Java' to paste directly into your IDE. Fully typed, zero compilation errors, with nested records automatically extracted.
Frequently Asked Questions
Does my JSON payload get sent to any server?
No. All parsing, AST traversal, and Java code generation happen strictly in your browser using JavaScript. No network requests are made, and your payload is never stored anywhere.
Why use Java Records instead of Lombok @Data for DTOs?
Java 17+ records provide language-level immutability, zero bytecode manipulation, and built-in pattern matching. In Spring Boot 3 & 4, Jackson seamlessly deserializes JSON directly into records via canonical constructor parameters.
How are nested objects and arrays inferred?
Nested JSON objects generate nested static records with PascalCase class names derived from the JSON property key. Arrays of primitives become List<T>, and arrays of objects resolve into typed collections of the corresponding nested record.
How does the converter distinguish Integer from Long and Double?
Whole numbers that exceed the 32-bit signed integer range (-2,147,483,648 to 2,147,483,647) automatically map to Long. Numbers containing decimal points map to Double.
How does snake_case to camelCase mapping work?
When enabled, JSON keys like 'order_id' become camelCase Java field names ('orderId') decorated with `@JsonProperty("order_id")` so Jackson correctly serializes and deserializes them.
Deepen your architecture knowledge with practical, production-tested guides:
Client-Side Privacy Guarantee
This tool never transmits your payloads to any server. Open DevTools (F12) → Network tab to verify that zero HTTP requests are sent while using this page.