Challenge: Adding a Custom Gson Deserializer
The JSON response from Flickr contains multiple layers of nested data (Figure 24.6). In the section called Deserializing JSON text into model objects, you created model objects to map directly to the JSON hierarchy. But what if you did not care about the data in the outer layers? Wouldn’t it be nice to avoid cluttering your codebase with unnecessary model objects?
By default, Gson maps all of the JSON data directly to your model objects by matching Kotlin property names (or
@SerializedName annotations) to JSON field names.
You can customize this behavior by defining a custom com.google.gson.JsonDeserializer.
For this challenge, implement a custom deserializer to strip out the outermost ...