UTILS.
100% in-browser

JSON to Java POJO

Create Java POJO classes from a JSON sample, with Jackson or Gson annotations, generated getters and setters, and boxed types for nullable fields.

output

About this tool

The JSON to Java POJO tool converts a pasted JSON sample into Java model classes, the way jsonschema2pojo does but instantly in your browser. It parses the JSON, infers Java types recursively, and emits one class per object: strings become String, integers int or long, other numbers double, booleans boolean, arrays List<T>, and nested objects their own PascalCase classes declared before the parents that use them.

All parsing and generation run locally with JSON.parse and plain JavaScript, so your payloads never leave the page. Fields are camelCased; when the JSON key is not already camelCase the tool adds @JsonProperty("originalKey") (Jackson) or @SerializedName("originalKey") (Gson), or nothing in plain-fields mode. Fields that can be null in any sample use the boxed wrapper types (Integer, Long, Double, Boolean) so null is representable. Jackson classes carry @JsonIgnoreProperties(ignoreUnknown = true) for forward compatibility.

The annotation-style toggle selects Jackson (default), Gson, or no annotations, and only the imports actually used are included. The accessors toggle chooses between generated getX()/setX() methods on private fields (default) or plain public fields. Copy the result or download it as a .java file to drop straight into your project.

Frequently asked questions

Which Java types are produced?
string to String, integer to int (long when a value exceeds the int range), non-integer number to double, boolean to boolean, array to List<T>, and object to a named class. Fields that may be null use boxed types — Integer, Long, Double, Boolean.
Jackson or Gson annotations?
The annotation toggle picks Jackson (@JsonProperty, plus @JsonIgnoreProperties(ignoreUnknown = true)), Gson (@SerializedName), or none. Annotations are only added when the camelCase field name differs from the original JSON key.
Do I get getters and setters?
By default each private field gets a generated getX() and setX(). Switch the accessors toggle to plain public fields if you prefer records-style bare fields without accessor methods.
Is my JSON sent anywhere?
No. The JSON is parsed and the classes are generated entirely in your browser with plain JavaScript. Nothing is uploaded, so you can paste internal API responses safely.

More tools