JSON to Java
Generate Java classes or records from a JSON sample.
JSON input
Java code
About this tool
Paste a JSON sample and get a single compilable .java file: the root class plus every nested object as a public static inner class (or nested record). When the root is an array of objects, the item type is generated.
Type mapping
- Whole numbers →
Integer,Longoutside the 32-bit range,BigIntegerbeyond 64 bits; numbers with a decimal point or exponent →Double. true/false→Boolean; text →String; arrays →List<T>.null-only values, empty arrays and mixed arrays →Object.- Field names are camelCased; Java keywords and names of
Objectmethods (hashCode,toString,getClass,wait…) get a trailing underscore. Keep Jackson on so the original JSON names still map.
Options
Records (Java 16+) produce immutable records, so Lombok and accessors are disabled. Lombok @Data generates accessors at compile time instead of writing them out.
Privacy
Code is generated entirely in your browser. The JSON you paste is never uploaded, stored or logged.