Retrofit 2 — Handling of Empty Server Responses with Custom Converter

Some APIs return an empty response body to signal the client that there is no object. Retrofit's converters can trip over that, because it can be an invalid representation in their respective data format. For example, an empty object needs to be {} in JSON.

In this tutorial you'll learn how you can handle these empty server responses. We'll show you an example of treating them as valid null objects.

Retrofit Series Overview

Continue reading

University Enrollment Required

Future Students benefit from value packed videos and tutorials.

Enroll to receive exclusive content or sign in if you’re already a Future Student.

Enroll me for $15/mo

Explore the Library

Find interesting tutorials and solutions for your problems.