JSON to Java POJO Converter

Paste a JSON sample and get Java classes you can drop into your project: Lombok @Data classes or plain POJOs, one class per nested object, with List fields for arrays.

Input Code
Ready - Type or paste code in the left panel
Output Code
Ready - Type or paste code in the left panel

How to convert JSON to Java

  1. Paste your JSON into the left panel, or click Load Sample.
  2. Java is already selected as the output on the right.
  3. Click Convert, then Copy Output.

Example

This JSON:

{ "id": 101, "name": "Ada Lovelace", "email": "ada@example.com", "active": true, "balance": 250.75,
  "address": { "city": "London", "postcode": "N1 9GU" }, "tags": ["admin", "beta"] }

becomes:

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Address {
    private String city;
    private String postcode;
}

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RootObject {
    private int id;
    private String name;
    private String email;
    private boolean active;
    private double balance;
    private Address address;
    private List<String> tags;
}

How JSON types map to Java

JSON valueJava type
"text"String
101int
250.75double
trueboolean
{ … }a new class named after the key
["a", "b"]List<String>

Lombok or plain POJO?

Pick Lombok under Java Options and every class gets @Data plus the constructor annotations you choose (no-args, all-args or both). That keeps classes short, but your project needs the Lombok dependency and annotation processing. Pick Standard (POJO) for classes with private fields, getters and setters and no extra library, for example in plain Java EE or Android code.

Using the classes with Jackson or Gson

Spring Boot and most Java projects read JSON with Jackson. The generated field names match your JSON keys in camelCase, so objectMapper.readValue(json, RootObject.class) works without extra annotations. If your API uses snake_case keys such as user_name, either choose Snake Case output, or keep camelCase fields and set PropertyNamingStrategies.SNAKE_CASE on the ObjectMapper.

Things to check after generating

Is my JSON sent anywhere?

Your JSON is sent to our server, converted in memory and returned; it isn't stored. See the privacy policy.

Frequently asked questions

How do I convert JSON to a Java POJO?

Paste the JSON on the left, keep Java selected on the right, choose Lombok or Standard (POJO) and click Convert. Copy the classes into your project and rename RootObject.

Does it create classes for nested JSON objects?

Yes. Each nested object becomes its own class named after its key, and the parent gets a field of that type. Arrays of values become List fields.

Do I need Lombok?

Only if you choose the Lombok option. Standard (POJO) output has getters and setters written out and needs no library.

Can I convert Java back to JSON?

Yes. Choose Java toString() / DTO as the input language to turn log output such as UserDTO(id=1, name=Amit) into JSON.

Other languages: JSON to TypeScript · JSON to Go · JSON to Python · JSON to C# · JSON to Kotlin · all languages

Share Content

Choose what to share and generate an instant link

🔥 One-time link Content deleted from server after first view
✉️
Uploading to server…