Skip to content
@problem4j

Problem4J

A modest effort to make RFC 7807 Problem Details (aka RFC 9457) easy to use in Java applications and commonly used web frameworks.

Problem4J Banner

Designing clear and consistent error responses in a REST API is often harder than it looks. Without a shared standard, each application ends up inventing its own ad-hoc format, which quickly leads to inconsistency and confusion. RFC 7807 - Problem Details for HTTP APIs solves this by defining a simple, extensible JSON structure for error messages.

Problem4J brings this specification into the Java ecosystem, offering a practical way to model, throw, and handle API errors using Problem objects. It helps you enforce a consistent error contract across your services, while staying flexible enough for custom exceptions and business-specific details.

An example of application/problem+json response on HTTP API would look as follows.

{
  "status" : 400,
  "title" : "Bad Request",
  "detail" : "Validation failed",
  "errors" : [ {
    "field" : "email",
    "error" : "must be a well-formed email address"
  }, {
    "field" : "age",
    "error" : "must be greater than or equal to 18"
  } ]
}

It focuses on a minimal core API with optional integrations for popular Java frameworks.

Modules

Documentation

📘 https://problem4j.github.io

The documentation includes usage guides, examples, and module-specific details.


Problem4J aims to be small, explicit, and framework-friendly.

Pinned Loading

  1. problem4j-spring problem4j-spring Public

    Spring integration for library implementing RFC7807 (aka RFC9457)

    Java 4

  2. problem4j-core problem4j-core Public

    Core library implementing Problem model according to RFC7807 (aka RFC9457)

    Java

  3. problem4j-jackson problem4j-jackson Public

    Jackson integration for library implementing RFC7807 (aka RFC9457)

    Java

Repositories

Showing 5 of 5 repositories

Top languages

Java TypeScript

Most used topics

Loading…