ToolBuddy
In Browser

JSON to Java

Infer Java records from a JSON sample. Nested objects become public records with Jackson annotations. Keys missing from some objects in an array are optional. Conversion stays in the tab.

Runs in your browser. Nothing is uploaded.

0 characters · 0 lines

0 characters · 0 lines

About this tool

Infer Java records from a JSON sample. Objects become public records with Jackson annotations. When the Java name differs from the key, the component gets @JsonProperty. Keys missing from some objects in an array, and a JSON null next to a concrete value, become nullable with @JsonInclude. Whole numbers stay long. Other numbers become double.

How to use: paste JSON, copy the records. A root array of objects is written as List<RootItem> plus the item record. Empty objects become Map<String, Object> and empty arrays become List<Object>. This is a starting point. It does not add methods, builders, or Bean Validation.

Example: {"id":1,"name":"Ada","address":{"city":"London"}} yields record Root and record Address. The snippet expects jackson-annotations on the classpath. Related: JSON to TypeScript for interfaces, JSON to Go for structs, JSON to Python for dataclasses.

The sample stays in the tab. Nothing is uploaded. After the page loads, conversion works offline.

FAQ

Related Convert tools