promoteValueToName

fun promoteValueToName()

Changes the writer to treat the next value as a string name. This is useful for map adapters sothat arbitrary type adapters can use value to write a name value.

In this example, calling this method allows two sequential calls to value to produce the object, {@code {"a": "b"}}.

{@code * JsonWriter writer = JsonWriter.of(...); * writer.beginObject(); * writer.promoteValueToName(); * writer.value("a"); * writer.value("b"); * writer.endObject(); * }