{ }jsonkit
Tools/Convert/JSON to Java
Search tools…⌘K
Format
{ }JSON Formatter
≡→JSON Minifier
\"JSON Escape / Unescape
a→zJSON Sorter
⇄{}JSON Flattener
Validate
JSON Validator
±JSON Diff / Compare
§JSON Schema Generator
JWT Decoder
ΔJSON Patch / Merge Patch
kbJSON Size Analyzer
Convert
→csvJSON to CSV
csv→CSV to JSON
⇄ymlJSON ⇄ YAML
⇄xmlJSON ⇄ XML
→tsJSON to TypeScript
b64Base64 Encode / Decode
%2FURL Encode / Decode
clkTimestamp Converter
→zJSON to Zod
→pyJSON to Pydantic
→goJSON to Go
→javaJSON to Java
⇄jsonlJSON ⇄ JSONL
5→JSON5 / JSONC to JSON
Query
$.JSONPath / JQ Tester
.*Regex Tester
Generate
Mock JSON Data Generator
idUUID / NanoID Generator
#Hash Generator
→java

JSON to Java Records & Classes

Infer Java 17 records or POJO classes from sample JSON.
processes as you type · client-side
Sample
Upload
Style
RecordsClasses
Jackson annotations
⧉ Copy output ⌘C
Download
Share
Clear
Input219 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import java.util.List; public record Plan( String tier, long seats, String renews ) {} public record Root( String id, String name, String email, boolean active, List<String> roles, Plan plan ) {}
✓ valid (RFC 8259)219 B → 233 B0.0 msLn 1, Col 1UTF-8

About JSON to Java

The JSON to Java converter turns a sample JSON document into Java 17 records or classic POJO classes. Paste an API response and get typed Java source describing its shape, ready to drop into a Spring or Jackson project instead of hand-writing every field, constructor and getter.

Conversion runs entirely in your browser with no upload, so you can turn a real production payload into Java types without it ever leaving your machine. It is free and needs no account.

It is built for Java and Kotlin backend developers who consume JSON APIs and want accurate model classes fast, including the nested types, List generics and Jackson bindings they would otherwise write by hand.

How it works

Records or classes

Choose Records to emit compact Java 17 records — public record User(String id, ...) {} — or Classes to emit traditional POJOs with private final fields and public getters. Records suit immutable DTOs; classes suit codebases still on older Java or frameworks that expect getters.

Type inference

Types are inferred from the sample values: strings become String, whole numbers become long, decimals become double, true/false become boolean, and a null or empty field becomes Object because the sample can't reveal its real type. Nested objects become their own named record or class referenced by the parent.

Arrays and List generics

JSON arrays become List<X>, where X is inferred from the elements — List<String>, a named element record for arrays of objects, or List<Object> for empty or mixed arrays. java.util.List is imported automatically, and only when a List actually appears in the output.

Jackson annotations

With Jackson on, any JSON key that isn't a valid camelCase Java field — like first-name or user_id — gets an @JsonProperty("original-key") so deserialization still maps correctly. The com.fasterxml.jackson.annotation import is added only when at least one annotation is emitted, keeping clean payloads import-free.

Frequently asked questions

Does it generate Java records or classes?

Both. Pick Records for Java 17 immutable record types, or Classes for POJOs with private final fields and getters. Toggle the Style control to switch.

How are numbers typed?

Whole numbers become long and numbers with a decimal point become double. Because a single sample can't prove the intended width, widen or narrow to int, Integer or BigDecimal by hand where you need to.

When does it add @JsonProperty?

Only when Jackson annotations are on and a JSON key differs from the camelCase Java field name it maps to — for example first-name maps to a firstName field with @JsonProperty("first-name"). Keys that already match get no annotation.

Can I paste production API responses safely?

Yes. Conversion runs entirely in your browser, so the JSON you paste is never uploaded or logged.

Why did a field come out as Object?

The sample didn't carry enough information — a null value, an empty array or an array of mixed types can't reveal a concrete Java type, so it falls back to Object. Provide a fuller example or refine the type by hand.