Skip to content
Veltoryx Technologies

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.

Runs in your browser. Nothing is uploaded.
Target:
Root:
Package:
Input JSON(482 bytes)
Generated Java (Record)(3 types)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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

1
Paste or load JSON

Paste your raw JSON payload into the input editor, or click 'Load Sample' to explore an example.

2
Choose output format & options

Select Java 17+ Record or Class (POJO), toggle Jackson annotations, Lombok, and snake_case to camelCase conversion.

3
Copy or download Java code

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.

📖 Related Lessons on Veltoryx Learn

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.

🛡 Safe for confidential enterprise payloads