###問題
配列のJSONデータを取得するとresultで
[Failure: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $]
とエラーが出ます。
###環境
AndroidStudio3.0
Kotlin1.1.15
fuel
###コード
kotlin.kt
URL.httpGet() .responseObject(UserDetail.Deserializer()) { request, response, result -> Log.d("request", request.toString()) Log.d("result", result.toString()) Log.d("response", response.toString()) val (userDetails, error) = result userDetails?.forEach { userDetail -> Log.d("response", userDetail.user_name) } } } data class UserDetail( val user_name: String, val name_kana: String, val icon_flag: String, val gender_for_user: String, val birth_date: String, val blood_type: String, val weight: Int){ class Deserializer : ResponseDeserializable<Array<UserDetail>> { override fun deserialize(content: String): Array<UserDetail>? = Gson().fromJson(content, Array<UserDetail>::class.java) } }
サーバから返されるデータ
Illuminate\Support\Collection Object ( [items:protected] => Array ( [0] => stdClass Object ( [user_name] => テスト [name_kana] => テスト [icon_flag] => 2 [gender_for_user] => female [birth_date] => 2018-02-17 [blood_type] => B [weight] => 2.0 ) ) )
Deserializerで配列として返していると思うのですが、どこに問題があるのでしょうか?
よろしくお願いいたします。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。