我的代码昨天工作,但今天没有工作。错误:应为数组开头,但在第1行第28列路径处为字符串$.result我的代码和类:Postman 结果:
我改造:
我的代码和类:
x1c4d 1x指令集
几次改变我的代码,但没有结果!谢谢
wko9yo5t1#
首先,我在https://run.mocky.io/上为自己创建了一个假的apiHere is my api responseYour interface will look like this:Your MultiPlatformResponse Model will look like this:Your MultiPlatformResult Model will look like this:Your MultiPlatformBanner Model will look like this:Your MultiPlatformAvatar Model will look like this:
//retrofit implementation implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' //Manifest <uses-permission android:name="android.permission.INTERNET"/> <application android:usesCleartextTraffic="true">
rkttyhzu2#
您是否在Retrofit中使用GsonConverterFactory将API响应从JSON转换为对象?
GsonConverterFactory
2条答案
按热度按时间wko9yo5t1#
首先,我在https://run.mocky.io/上为自己创建了一个假的api
Here is my api response
Your interface will look like this:
Your MultiPlatformResponse Model will look like this:
Your MultiPlatformResult Model will look like this:
Your MultiPlatformBanner Model will look like this:
Your MultiPlatformAvatar Model will look like this:
rkttyhzu2#
您是否在Retrofit中使用
GsonConverterFactory
将API响应从JSON转换为对象?