GenerateSourceCode
Developer Productivity Tools
Java Spring Boot REST API JSON

JSON → Java POJO Generator

Convert JSON input into ready-to-use Java POJO classes for Spring Boot RESTful applications.

1. Enter JSON
2. Generated Java POJO

How to Copy Generated POJO into a Spring Boot Project

Step 1 — Create a package

In your Spring Boot project, create a package such as:

src/main/java
└── com.example.demo
    ├── controller
    ├── service
    ├── repository
    └── model
Step 2 — Create the POJO Java file

Create a Java class under the model or dto package.

src/main/java/com/example/demo/model/Employee.java
Step 3 — Copy the generated code

Click the Copy button above. Open the Java file in Eclipse, IntelliJ IDEA or another IDE and paste the generated code.

Step 4 — Add the package declaration

Make sure the package name matches the directory.

package com.example.demo.model;
Step 5 — Use the POJO in your REST Controller
@RestController
@RequestMapping("/api/employees")
public class EmployeeController {

    @PostMapping
    public Employee createEmployee(
            @RequestBody Employee employee) {

        System.out.println(employee);

        return employee;
    }
}
Step 6 — Send JSON from Postman
POST http://localhost:8080/api/employees

Content-Type: application/json

{
    "id": 101,
    "name": "John",
    "salary": 75000,
    "active": true
}
Step 7 — Spring Boot automatically converts JSON

Spring Boot uses Jackson to deserialize the incoming JSON into the generated Java POJO.

JSON
 ↓
Jackson
 ↓
Employee POJO
 ↓
REST Controller
 ↓
Service
 ↓
Repository
💡 Tip: For REST APIs, it is recommended to place request/response classes in a dedicated dto package. Example:
src/main/java/com/example/demo/dto/EmployeeRequest.java
src/main/java/com/example/demo/dto/EmployeeResponse.java