且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用QueryMap进行改造

更新时间:2022-06-12 22:48:09

您可以使用JsonElement响应类型

 @GET("xxx")
    Call<JsonElement> groupList(@QueryMap Map<String, String> options);

您将收到的每个呼叫JsonElement,您可以将其转换为JsonObjectJsonArray,甚至String。您可以根据您的内容对其进行解析/取消具体化

public void onResponse(Call<JsonElement> call, Response<JsonElement> response) {
      JsonElement jsonElement = response.body();
      //JsonArray array = jsonElement.getAsJsonArray();
      //JsonObject Obj = jsonElement .getAsJsonObject();
}