预期BEGIN_OBJECT但在第1行第570列是BEGIN_ARRAY

时间:2014-08-10 16:43:35

标签: java android json gson

我正在使用Foursquare API中的无用访问方法创建一个Android应用程序。但是,我正在使用Gson API来检索Json和volley。一切似乎都运行良好,json格式已经获得,因为我使用log.d在我的DDMS窗口中跟踪。但是有一个错误 com.google.gson.JsonSyntaxException:预期BEGIN_OBJECT但在第1行第570列是BEGIN_ARRAY

这是我的foursquare API链接。

  

https://api.foursquare.com/v2/venues/explore?client_id=WUZWQOWZ4JOAXKZWDACVODXM3VM3OYPAM3TLYPBLOXVZ01E1&client_secret=XWXSVDQOQ020MKHUG2AY42EOCJCI4JMQE3GIAE3DE3XRKQ32&ll=3.107172,101.476510&section=food&limit=10&v=20130815

ArrayList<FVenue> ven = data.getResponse().getGroups().getItems();
adapter = new RestListAdapter(getActivity(),data.getResponse().getGroups().getItems());
lv.setAdapter(adapter);

1 个答案:

答案 0 :(得分:0)

试试这个:

public class MyResponse extends ArrayList<FVenue> implements Serializable {
//this code assumes you have an FVenue.class which defines the FVenue entity
}

然后当您尝试反序列化时:

Gson gson = new Gson();
MyResponse data = gson.fromJson("yourjsonstring", MyResponse.class);
//do whatever you want with the data