Reputation: 365
I am working in a legacy system with Java/EJB/JPA/thorntail/wildfly.
The project has:
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-jsonb</artifactId>
<version>2.6.0.Final</version>
</dependency>
JSON-B provides support for JSON Processing according to JSR-367.
I need to send null values in API/Rest. Anything similar to @JsonInclude(Include.ALWAYS)
for Jackson.
Example that I need:
PersonApi with name=Any, age=null
{
"name": "Any",
"age": null
}
Is there some config to do this? ... some annotation, some config to load and resolve it?
Upvotes: 0
Views: 280
Reputation: 3476
You can use javax.json.bind.annotation.JsonbNillable
annotation:
@JsonbNillable
public static class PersonApi {
private String name;
private Integer age;
//constructors, getters and setters are omitted
}
Upvotes: 0