Skip to content

Commit 5f1f592

Browse files
committed
introduce null-save JsonObjectBuilder.add and JsonGenerator.write methods #213
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
1 parent 3c3b1b1 commit 5f1f592

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

api/src/main/java/jakarta/json/JsonConfig.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
*/
2424
public final class JsonConfig {
2525

26+
/**
27+
* Configuration property to ignore null values. All providers
28+
* must support this property. The value of the property is boolean.
29+
*/
30+
public static final String IGNORE_NULL = "jakarta.json.JsonConfig.ignoreNull";
31+
2632
/**
2733
* Configuration property to define the strategy for handling duplicate keys.
2834
*

api/src/main/java/jakarta/json/JsonObjectBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@
8686
* </code>
8787
* </pre>
8888
*
89-
* <p>This class does <em>not</em> allow <code>null</code> to be used as a name or
90-
* value while building the JSON object
89+
* <p>By default, this class does <em>not</em> allow <code>null</code> to be used as a name or
90+
* value while building the JSON object. It is possible to change this behavior with configuration
91+
* {@link JsonConfig#IGNORE_NULL}
9192
*
9293
* @see JsonArrayBuilder
9394
*/

0 commit comments

Comments
 (0)