Gson
The gson extension package for Fuel
.
Installation
You can download and install fuel-gson
with Maven
and Gradle
. The gson package has the following dependencies:
Gson: 2.8.5
implementation 'com.github.kittinunf.fuel:fuel:<latest-version>'
implementation 'com.github.kittinunf.fuel:fuel-gson:<latest-version>'
Usage
See FuelGson.kt
Gson Deserialization
Fuel also provides a built in support for Gson Deserialization. This is possible by including the Gson module in your dependency block.
data class HttpBinUserAgentModel(var userAgent: String = "")
Fuel.get("/user-agent").responseObject<HttpBinUserAgentModel> { _, _, result ->
// handle result similarly as it is shown by the core module
}
Last updated
Was this helpful?