@@ -145,6 +145,20 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
145
145
*/
146
146
String PRETTY_PRINTING = "jakarta.json.stream.JsonGenerator.prettyPrinting" ;
147
147
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
+
148
162
/**
149
163
* Writes the JSON start object character. It starts a new child object
150
164
* context within which JSON name/value pairs can be written to the object.
@@ -336,7 +350,9 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
336
350
* @return this generator
337
351
* @throws jakarta.json.JsonException if an i/o error occurs (IOException
338
352
* would be cause of JsonException)
339
- * @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity.
353
+ * @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity
354
+ * when {@link JsonGenerator#WRITE_NAN_AS_NULLS} and/or {@link JsonGenerator#WRITE_NAN_AS_STRINGS}
355
+ * is not set.
340
356
* @throws JsonGenerationException if this method is not called within an
341
357
* object context
342
358
*/
@@ -485,7 +501,9 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
485
501
* would be cause of JsonException)
486
502
* @throws JsonGenerationException if this method is not called within an
487
503
* array or root context.
488
- * @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity.
504
+ * @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity
505
+ * when {@link JsonGenerator#WRITE_NAN_AS_NULLS} and/or {@link JsonGenerator#WRITE_NAN_AS_STRINGS}
506
+ * is not set.
489
507
*/
490
508
JsonGenerator write (double value );
491
509
0 commit comments