Simple types used with APIs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore should not be ignored Jan 3, 2019
gradlew Adding gradl wrapper Jan 3, 2019


This project contains a number of simple types used by Bankdata financial APIs. The project is intended to aid the implementation of Java POJO models for JSON serialization.

Maven Central Javadoc Build Status License: MIT Known Vulnerabilities


The library is deployed to Maven Central dk.bankdata.api:types and may be used from both Gradle or Maven.

Problem Details

The library contains an implementation of RFC 7807 - Problem Details for HTTP APIs which can be used in responses of type application/problem+json as follows.

ProblemDetails problem = new ProblemDetails.Builder()
    .title("Error Occurred")
    .detail("An unrecoverable error occurred")
    .extensionMember("balance", 23)

Which will be serialized as:

  "type": "https://type",
  "title": "Error Occurred",
  "detail": "An unrecoverable error occurred",
  "status": 500,
  "instance": "https://instance/1",
  "balance": 23

Note the use of extension members relies on Jackson serialization features.

Amount with Currency

The library contains a simple type for representing an amount with associated currency. Simply use dk.bankdata.api.types.CurrencyAmount which will be serialized to json as:

  "amount": 12345.12,
  "currency": "DKK"

Date and Time Serialization

The library contains simple support for always serializing date and time into and JSON object with milliseconds from unix epoch as well as a more human-readable ISO formatted date. Note this requires Jackson to be used for serialization.

The date and time will be serialized as follows.

  "epochMilli": 3600000,
  "utc": "1970-01-01T01:00:00Z"

This may be achieved either by using dk.bankdata.api.types.DateTime or by using a standard Java java.time.Instant adding a Jackson serializer like so.

class POJO {
    @JsonSerialize(using = DateTimeSerializer.class)
    Instant dateTime;