@@ -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,9 +350,14 @@ 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.
356
+ *
340
357
* @throws JsonGenerationException if this method is not called within an
341
358
* object context
359
+ *
360
+ * @see {@link JsonGenerator#WRITE_NAN_AS_NULLS}, {@link JsonGenerator#WRITE_NAN_AS_STRINGS}
342
361
*/
343
362
JsonGenerator write (String name , double value );
344
363
@@ -485,7 +504,11 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
485
504
* would be cause of JsonException)
486
505
* @throws JsonGenerationException if this method is not called within an
487
506
* array or root context.
488
- * @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity.
507
+ * @throws NumberFormatException if the value is Not-a-Number (NaN) or infinity
508
+ * when {@link JsonGenerator#WRITE_NAN_AS_NULLS} and/or {@link JsonGenerator#WRITE_NAN_AS_STRINGS}
509
+ * is not set.
510
+ *
511
+ * @see {@link JsonGenerator#WRITE_NAN_AS_NULLS}, {@link JsonGenerator#WRITE_NAN_AS_STRINGS}
489
512
*/
490
513
JsonGenerator write (double value );
491
514
0 commit comments