Skip to content

Commit df30a45

Browse files
committed
provide NaN and Infinity when (de)serializing Java Numbers
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
1 parent e865594 commit df30a45

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ 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+
String WRITE_NAN_AS_NULLS = "jakarta.json.stream.JsonGenerator.writeNanAsNulls";
152+
153+
/**
154+
* Configuration property to generate NaN, +Infinity and -Infinity as Strings.
155+
*/
156+
String WRITE_NAN_AS_STRINGS = "jakarta.json.stream.JsonGenerator.writeNanAsStrings";
157+
148158
/**
149159
* Writes the JSON start object character. It starts a new child object
150160
* context within which JSON name/value pairs can be written to the object.
@@ -486,6 +496,8 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
486496
* @throws JsonGenerationException if this method is not called within an
487497
* array or root context.
488498
* @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity.
499+
*
500+
* @see {@link #WRITE_NAN_AS_NULLS}, {@link #WRITE_NAN_AS_STRINGS}
489501
*/
490502
JsonGenerator write(double value);
491503

0 commit comments

Comments
 (0)