Tag: gson retrofit2

Retrofit和Gson:解析数组/元素多态对象

我按顺序得到回应: “parameters”: { “parameter”: { “Data”:”value” } }, “parameters”:{ “parameter”: [ { “Data”:”value” }, { “Data”:”value” }, ] }, 如果我调用List参数,则会出现错误: 预计BEGIN_OBJECT但获得BEGIN_ARRAY 我需要解析参数来获取值 public class ApiClient { public static final String BASE_URL =”http://………”; private static Retrofit retrofit = null; public static Retrofit getClient() { OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(1, TimeUnit.MINUTES) .writeTimeout(1, TimeUnit.MINUTES) .readTimeout(1, TimeUnit.MINUTES) .addInterceptor(new […]

如何使用注释在改进2中解析android中的动态json

我有一个JSON结构,我想使用改进2(@Expose)解析。 下面我提到了JSON。 需要帮助来使用动态注释来解析它。 { “status”: 1, “message”: “success”, “data” : [ { “type”: 1, “heading”: “”, “description”: “”, “created_on”: 141123213, “author_id”: 123, “author_name”: “some name”, “author_pic”: “some_pic”, “read_time”: “3.1 min”, “post_pic_url”: “”, “post_web_url”: “”, “isLiked”: false, “isSaved”: false, “totalLikes”: 12 }, { “type”: 2, “author_id”: 123, “author_name”: “some name”, “author_pic”: “some pic”, “author_about”: “”, “tags”:[ […]