Skip to content

Include empty fields in JSON responses #2132

@pieperm

Description

@pieperm

Is your feature request related to a problem? Please describe.
By default, Micronaut does not include null fields when serializing a Java object to JSON. When using any of our APIs, we would like to ensure that all fields are present in the JSON response, even if those fields are null.

Describe the solution you'd like
This change would affect all services. This can be done by changing the Jackson configuration.

Describe alternatives you've considered
Alternatively, each entity and response DTO could be annotated with @JsonInclude to achieve this behavior. However, it could result in inconsistently defining how objects are serialized. Since this is behavior we want for all services, it makes more sense to configure that at the application level.

Additional context
Depends on #2131

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions