按照@che10 的回答,您应该得到以下结果:
data class Data(
// Assuming you are using Moshi https://github.com/square/moshi
// Use @SerializedName("data") if you're using Gson
@Json(name="data")
val stickers: List<Sticker>,
val meta: Meta,
val pagination: Pagination
)
data class Sticker(
val designer: String,
val id: String,
val images: Images,
val is_animated: Boolean,
val rating: String,
val tags: List<String>,
val url: String
)
data class Pagination(
val offset: String,
val total: Int,
val total_count: Int
)
data class Meta(
val msg: String,
val status: Int
)
// Different fields but of two types so we can reuse the classes
// Difference between AnimatedImage and StillImage is the two webp fields
data class Images(
// Animated images
val fixed_height: AnimatedImage,
val fixed_height_downsampled: AnimatedImage,
val fixed_height_medium: AnimatedImage,
val fixed_height_medium_downsampled: AnimatedImage,
val fixed_height_small: AnimatedImage,
val fixed_width: AnimatedImage,
val fixed_width_downsampled: AnimatedImage,
val fixed_width_medium: AnimatedImage,
val fixed_width_medium_downsampled: AnimatedImage,
val fixed_width_small: AnimatedImage,
// Still images
val fixed_height_still: StillImage,
val fixed_height_medium_still: StillImage,
val fixed_height_small_still: StillImage,
val fixed_width_still: StillImage,
val fixed_width_medium_still: StillImage,
val fixed_width_small_still: StillImage,
)
data class StillImage(
val url: String,
val size: Int,
val height: Int,
val width: Int,
)
data class AnimatedImage(
val url: String,
val size: Int,
val height: Int,
val width: Int,
val webp: String,
val webp_size: Int
)