JSON to Java Record Converter
Paste any JSON and get Java records instantly — nested types, arrays and optional fields included.
Root type name
JSON input
Java records
Paste any JSON and get Java records instantly — nested types, arrays and optional fields included.
Root type name
JSON input
Java records
In short: A JSON to Java converter writes Java record types for a JSON document, annotated with Jackson @JsonProperty. Nested objects become their own records and arrays become List<T>.
Writing Java records by hand for every API response is slow and easy to get wrong. This tool infers the types from real data: it merges every item of an array, so a field that is missing from some items is marked optional instead of being silently dropped.
Deserialize with new ObjectMapper().readValue(json, Root.class). Records require Java 16+ and Jackson 2.12+. Everything runs locally in your browser — safe for private payloads.
strings → String, integers → long, decimals → double, booleans → boolean (boxed types when null or optional), arrays → List<T> and unknown values → Object.
Nullable and optional fields use boxed types (Long, Boolean) so they can hold null.
Keys are converted to camelCase component names; @JsonProperty("original-key") keeps the mapping to the JSON key.
Paste your JSON, set a root type name, and Java records are generated instantly. Copy the result or download it as a .java file.
Each nested object becomes its own named type and arrays use the element type inferred from all of their items, so arrays of objects are fully typed.
Nullable and optional fields use boxed types (Long, Boolean) so they can hold null.
Records are concise, immutable and supported by Jackson 2.12+ and Java 16+. If you need mutable POJOs, copy the fields into a class and add Lombok or getters/setters.
No. Generation runs entirely in your browser — your JSON never leaves your device.
JSON to TypeScript · JSON to JSON Schema · JSON Validator · JSON Formatter
Browse all free JSON tools →