@@ -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.
@@ -336,7 +350,9 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
336350 * @return this generator
337351 * @throws jakarta.json.JsonException if an i/o error occurs (IOException
338352 * 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.
340356 * @throws JsonGenerationException if this method is not called within an
341357 * object context
342358 */
@@ -485,7 +501,9 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
485501 * would be cause of JsonException)
486502 * @throws JsonGenerationException if this method is not called within an
487503 * 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.
489507 */
490508 JsonGenerator write (double value );
491509
0 commit comments