JSON:API Compliant
Purpose-built around the JSON:API specification — predictable request/response format and processing rules.
Framework Agnostic
Works with Spring Boot, Quarkus, and plain Jakarta Servlet API. Add one dependency and the framework auto-configures itself in your environment.
Pluggable Architecture
Hook into the request pipeline with the visitor-based Plugin System. Ships with Access Control, Sparse Fieldsets, OpenAPI, and Compound Documents plugins.
Built for Scale
Whether you’re standardizing your organization’s API layer across dozens of services or building a new microservice from scratch, JsonApi4j provides a consistent foundation that eliminates API design debates and reduces boilerplate.
Compound Documents
Multi-level include queries with parallel batch resolution, built-in caching, and Cache-Control aggregation. Deployable at the application or API Gateway level.
Fine-Grained Access Control
Declarative, annotation-driven authorization — per-field anonymization based on access tier, OAuth2 scopes, and resource ownership. No changes to core logic.
Parallel Execution
Relationship resolution, compound document fetching, and batch operations run concurrently. Supports virtual threads (Project Loom) for maximum throughput.
Developer Experience
Minimal Boilerplate
Define resources, relationships, and operations — the framework automatically generates JSON:API documents, pagination links, error responses, and many more.
Persistence/Data Source Agnostic
No JPA or Hibernate required. Works with SQL, NoSQL, REST clients, in-memory stores, or any data source you bring.
Auto-Generated OpenAPI
Always-in-sync API documentation derived from the same metadata used at runtime. Powerful customization capabilities. Exposed as JSON or YAML via a dedicated endpoint.
Quick Example
Define a resource and an operation — that’s all it takes to expose a fully compliant JSON:API endpoint:
@JsonApiResource(resourceType = "users")
public class UserResource implements Resource<UserDbEntity> {
@Override
public String resolveResourceId(UserDbEntity dto) {
return dto.getId();
}
@Override
public UserAttributes resolveAttributes(UserDbEntity dto) {
return new UserAttributes(dto.getFullName(), dto.getEmail());
}
}
@JsonApiResourceOperation(resource = UserResource.class)
public class UserOperations implements ResourceOperations<UserDbEntity> {
@Override
public CursorPageableResponse<UserDbEntity> readPage(JsonApiRequest request) {
return CursorPageableResponse.fromItemsAndCursor(
userDb.readAll(request.getCursor()),
userDb.nextCursor()
);
}
}
This produces paginated, JSON:API-compliant responses at GET /users — with links, resource identifiers, and error handling included automatically.
Read the full Getting Started guide