Monday 12 July 2021

Moshi JSON converter data exception error

Responses model from Server:

[
  {
    "at1": true,
    "at2": "2021-07-09T08:05:54.307Z",
    "at3": "ANDROID",
  }
]

Actual response: [] Error : com.squareup.moshi.JsonDataException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $

interface SomeInterface {
    fun getData(): Single<List<CustomObj>>
}

@Parcelize
data class CustomObj(
    val at1: Boolean,
    val at2: Date,
    val at3: String
) : Parcelable

I tried using @JsonClass(generateAdapter = true), but did not help.



from Moshi JSON converter data exception error

No comments:

Post a Comment