JSON to Java
- Records
- Jackson
- Instant
Records or POJOs with Jackson annotations and boxed types where nullable.
Paste input on the left to see java.
Everything runs in your browser — nothing is uploaded.
About java
Generating Java types from JSON produces records or traditional POJOs with Jackson JsonProperty annotations preserving the original key names. JSONic uses boxed types for fields that can be absent, so a missing value deserializes to null rather than silently becoming zero.
Paste JSON and get Java type definitions. Records give you immutable carriers in a few lines; the POJO mode emits the traditional private fields with getters and setters for frameworks that require them. Jackson JsonProperty annotations preserve the original key names, and fields that can be absent use boxed types so null is representable.
Questions
Record or POJO?
Records for anything Java 16 or later that just carries data — they are immutable and far shorter. POJOs when a framework requires a no-argument constructor and mutable setters, which some older ORM and bean-binding stacks still do.
Why are some fields boxed (Long rather than long)?
Primitives cannot be null. Any field that was missing from some array elements is boxed so an absent value deserializes to null rather than silently becoming zero.
Does this work with Gson instead of Jackson?
The structure does; the annotations do not. Replace @JsonProperty with @SerializedName and the classes work unchanged.