首页 文章
  • 0 votes
     answers
     views

    Android Kotlin Moshi Custom Json适配器

    好的,我有以下Json Pojo: data class JCategory( val id: Int, val name: String, val image: String?, val color: String?, val categories: List<JCategory>?, v...
  • 0 votes
     answers
     views

    将自定义错误抛给Retrofit 2

    我正在尝试使用此片段https://github.com/square/retrofit/issues/1497用于抛出自定义api错误,与Moshi . API的回报是: {"error":"message"} {"failure":"message"} {"success":&quo...
  • 0 votes
     answers
     views

    没有叫Kotlin Moshi适配器

    我正在尝试在Kotlin中编写一个Moshi适配器,它将根据整数值创建枚举,并且如果遇到不受支持的值,也会默认为特定的枚举值 . 永远不会调用我的适配器,这会导致默认的枚举适配器失败,包含堆栈跟踪 . 跟踪代码显示 @ToJson 注释以某种方式不存在,因此适配器isn't added when it should be . 声明适配器 enum class Status { IDLE, ...
  • 3 votes
     answers
     views

    Moshi的定制适配器,带有RxAndroid和Retrofit&Kotlin

    在为Android项目配置Kotlin之后,我写了一个简单的 MainActivity.kt . 它调用Retrofit来获取包含以下数据的JSON文件: { "message": "success", "user": { "username": "Eric" ...

热门问题