diff --git a/api/src/main/java/jakarta/json/JsonConfig.java b/api/src/main/java/jakarta/json/JsonConfig.java index 49c794b8..8b7c2594 100644 --- a/api/src/main/java/jakarta/json/JsonConfig.java +++ b/api/src/main/java/jakarta/json/JsonConfig.java @@ -23,6 +23,12 @@ */ public final class JsonConfig { + /** + * Configuration property to ignore null values. All providers + * must support this property. The value of the property is boolean. + */ + public static final String IGNORE_NULL = "jakarta.json.JsonConfig.ignoreNull"; + /** * Configuration property to define the strategy for handling duplicate keys. * diff --git a/api/src/main/java/jakarta/json/JsonObjectBuilder.java b/api/src/main/java/jakarta/json/JsonObjectBuilder.java index 6ada9abc..bed859d9 100644 --- a/api/src/main/java/jakarta/json/JsonObjectBuilder.java +++ b/api/src/main/java/jakarta/json/JsonObjectBuilder.java @@ -86,8 +86,9 @@ * * * - *

This class does not allow null to be used as a name or - * value while building the JSON object + *

By default, this class does not allow null to be used as a name or + * value while building the JSON object. It is possible to change this behavior with configuration + * {@link JsonConfig#IGNORE_NULL} * * @see JsonArrayBuilder */