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:
  • Fuel
  • Gson: 2.8.5
1
implementation 'com.github.kittinunf.fuel:fuel:<latest-version>'
2
implementation 'com.github.kittinunf.fuel:fuel-gson:<latest-version>'
Copied!

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.
1
data class HttpBinUserAgentModel(var userAgent: String = "")
2
3
Fuel.get("/user-agent").responseObject<HttpBinUserAgentModel> { _, _, result ->
4
// handle result similarly as it is shown by the core module
5
}
Copied!