Fuel - Documentation
  • README
  • Core
    • Fuel
  • Support
    • Android
    • Coroutines
    • AAC LiveData
    • RxJava
    • Reactor
  • Deserialization
    • Forge
    • Gson
    • Jackson
    • Json
    • Kotlinx-Serialization
    • Moshi
  • Legacy
    • v1.x.y
Powered by GitBook
On this page
  • Installation
  • Usage
  • Gson Deserialization

Was this helpful?

  1. Deserialization

Gson

PreviousForgeNextJackson

Last updated 6 years ago

Was this helpful?

The gson extension package for Fuel.

Installation

You can 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 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
}
download
Fuel
Gson