1
나는이 같은 JSON 문자열을 구문 분석을 시도하고 있었다 :연료, 코 틀린, GSON, BEGIN_ARRAY 예상하지만 BEGIN_OBJECT 라인에서 1
{
"count": 1,
"items": [
{
"organization_id": 6972979,
"organization_name": "Lorem ipsum dolor sit amet, consectetur adipisicing elit",
}
]
}
그리고 코 틀린 클래스 :
class LoremModel {
var count: Int? = null
var items: List<Lorem>? = null
class Lorem {
var organization_id: Int? = null
var organization_name: String? = null
constructor(organization_id: Int?, organization_name: String?) {
this.organization_id = organization_id
this.organization_name = organization_name
}
}
class ListDeserializer : ResponseDeserializable<List<LoremModel>> {
override fun deserialize(content: String) = Gson().fromJson<List<LoremModel>>(content, object : TypeToken<List<LoremModel>>() {}.type)
}
}
연료를 부분 :
Fuel.get("/lorem/search", listOf("keywords" to keyword, "category" to category, "pageNum" to "1", "pageSize" to "10")).
responseObject(LoremModel.ListDeserializer()) { request, _, item ->
}
하지만 오류가 점점 오전 :
0123을어떻게 해결할 수 있습니까?