FREE · DEVELOPER TOOLS
JSON to Java Record.
Turn a JSON sample into Java records with Jackson @JsonProperty annotations, boxed types for optional fields and nested records.
Loading the calculator…
Steps to use JSON to Java Record
Paste a JSON object or an array of objects and name the root record. Copy or download Root.java.
How JSON to Java Record processes your input
Integers map to long, decimals to double, lists to List<T>; optional fields use Long, Double or Boolean so they can be null. Java keywords get a trailing underscore.
JSON to Java Record: worked example
The sample becomes public record User(long id, @JsonProperty("user_name") String userName, …) with Order and Address nested inside.
Generate Java records from JSON
- Paste a JSON object, or an array of objects, from an API response or a sample file.
- Name the root record.
- Copy the code or download Root.java, then read the JSON with Jackson’s ObjectMapper.
Example: the sample becomes public record User(long id, @JsonProperty("user_name") String userName, …) with Order and Address records nested inside.
How types are mapped
- Integers map to long, decimals to double and lists to List<T>. Nested objects become nested records.
- Optional fields use the boxed types Long, Double or Boolean so they can be null.
- Keys that are not camelCase keep their JSON name with @JsonProperty. Java keywords get a trailing underscore.
- Records need Java 16 or later and jackson-databind 2.12 or later. Types come from the sample only. Everything runs in your browser. For Kotlin, see JSON to Kotlin; for TypeScript, JSON to TypeScript.
Questions about JSON to Java Record
Which Java version do I need?
Java 16 or later for records, with jackson-databind 2.12 or later to deserialize them.
Why are some fields Long instead of long?
Because they were missing or null in the sample. A boxed type can hold null; a primitive cannot.
Is my JSON uploaded?
No. The records are generated in your browser.
Is JSON to Java Record free, and do I need an account?
Yes. This tool is free to use in your browser without an account. Processing takes place on your device.
What are the limits and what should I check?
Needs Java 16+ and jackson-databind 2.12+. Types are inferred from the sample only. Everything is calculated in your browser; nothing you type is uploaded. Review the result before using it in your work.
Is my input sent to a server?
Your input is processed in your browser and is not uploaded by this tool. Files and pasted text are cleared when the page is refreshed. Normal website requests are still required to load the page and its libraries. Read the privacy explanation.