Encodes {@code null}. @return this writer.
()
| 664 | * @return this writer. |
| 665 | */ |
| 666 | @CanIgnoreReturnValue |
| 667 | public JsonWriter nullValue() throws IOException { |
| 668 | if (deferredName != null) { |
| 669 | if (serializeNulls) { |
| 670 | writeDeferredName(); |
| 671 | } else { |
| 672 | deferredName = null; |
| 673 | return this; // skip the name and the value |
| 674 | } |
| 675 | } |
| 676 | beforeValue(); |
| 677 | out.write("null"); |
| 678 | return this; |
| 679 | } |
| 680 | |
| 681 | /** |
| 682 | * Writes {@code value} directly to the writer without quoting or escaping. This might not be |