Parse JSON array response using Retrofit & Gson

前端 未结 4 1661
青春惊慌失措
青春惊慌失措 2020-11-27 18:53

Here is my JSONArray Response from Web service:

[
  {
    "sponsors": [
      {
        "leg_id": "NYL000067",
        "typ         


        
4条回答
  •  清酒与你
    2020-11-27 19:39

    The short answer is. if your JSON response starts with a JSON array, use a List:

    @GET("bills/")
    Call> getListOfSponsors(....);
    

    vs wrong:

    @GET("bills/")
    Call getListOfSponsors(....);
    

提交回复
热议问题