promoteValueToName

fun promoteValueToName()

Changes the writer to treat the next value as a string name. This is useful for map adapters so that 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, {"a": "b"}.

JsonWriter writer = JsonWriter.of(...);
writer.beginObject();
writer.promoteValueToName();
writer.value("a");
writer.value("b");
writer.endObject();