Search in sources :

Example 1 with JsonWriter

use of com.squareup.moshi.JsonWriter in project retrofit by square.

the class MoshiRequestBodyConverter method convert.

@Override
public RequestBody convert(T value) throws IOException {
    Buffer buffer = new Buffer();
    JsonWriter writer = JsonWriter.of(buffer);
    adapter.toJson(writer, value);
    return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
Also used : Buffer(okio.Buffer) JsonWriter(com.squareup.moshi.JsonWriter)

Aggregations

JsonWriter (com.squareup.moshi.JsonWriter)1 Buffer (okio.Buffer)1