Thread
#kotlin-fuel
    n

    Ncrnomarkovic

    1 year ago
    1st time using Fuel to make an http request and parse it into an object using the following tutorial: https://medium.com/@paul.allies/kotlin-http-get-with-deserialization-with-fuel-12691904e30b I don't understand the part about Gson. Looks like I don't have it defined in my gradle. Is this article's implementation the way to go? Is Fuel a good networking and parsing library? Advice appreciated - thank you
    Tony Mykhaylovsky

    Tony Mykhaylovsky

    1 year ago
    I'm curious about this as well
    kittinunf

    kittinunf

    1 year ago
    It looks okay to me, which part you don’t understand?
    for example, let’s use Github issue as example … Given this https://api.github.com/repos/kittinunf/Fuel/issues/1 I might create my object like this
    data class Issue(
            val id: Int = 0,
            val title: String = "",
            val url: String = ""
        ) {
            class Deserializer : ResponseDeserializable<Issue> {
                override fun deserialize(reader: Reader) = Gson().fromJson(reader, Issue::class.java)!!
            }
    }
    Then you plug the class into the
    responseObject
    Nikky

    Nikky

    1 year ago
    i definitly prefer using koltinx-serilaization whenver circumstances allow.. or jackson if not.. gson has the bad habit of sneaking nulls in non-nullable values in kotlin classes
    Tony Mykhaylovsky

    Tony Mykhaylovsky

    1 year ago
    @kittinunf Thank you. It works for one issue. How can I parse this endpoint https://api.github.com/repos/kittinunf/Fuel/issues ?
    kittinunf

    kittinunf

    1 year ago
    Add another one for
    List<Issue>
    ?