Skip to content

Commit 3e30e22

Browse files
committed
provide NaN and Infinity when (de)serializing Java Numbers
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent e865594 commit 3e30e22

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

api/src/main/java/jakarta/json/stream/JsonGenerator.java

+16
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
145145
*/
146146
String PRETTY_PRINTING = "jakarta.json.stream.JsonGenerator.prettyPrinting" ;
147147

148+
/**
149+
* Configuration property to generate NaN, +Infinity and -Infinity as nulls.
150+
*
151+
* @since 2.1
152+
*/
153+
String WRITE_NAN_AS_NULLS = "jakarta.json.stream.JsonGenerator.writeNanAsNulls";
154+
155+
/**
156+
* Configuration property to generate NaN, +Infinity and -Infinity as Strings.
157+
*
158+
* @since 2.1
159+
*/
160+
String WRITE_NAN_AS_STRINGS = "jakarta.json.stream.JsonGenerator.writeNanAsStrings";
161+
148162
/**
149163
* Writes the JSON start object character. It starts a new child object
150164
* context within which JSON name/value pairs can be written to the object.
@@ -486,6 +500,8 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
486500
* @throws JsonGenerationException if this method is not called within an
487501
* array or root context.
488502
* @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity.
503+
*
504+
* @see {@link #WRITE_NAN_AS_NULLS}, {@link #WRITE_NAN_AS_STRINGS}
489505
*/
490506
JsonGenerator write(double value);
491507

0 commit comments

Comments
 (0)