问题描述
- 怎么把百度返回的Gson格式信息转换成集合?
-
renderReverse&&renderReverse({"status":0,"result":{"location":{"lng":116.322987,"lat":39.983424071404},"formatted_address":"北京市海淀区中关村大街27号1101-08室","business":"人民大学,中关村,苏州街","addressComponent":{"city":"北京市","district":"海淀区","province":"北京市","street":"中关村大街","street_number":"27号1101-08室"},"cityCode":131}})怎么解析成集合?
Gson gso=new Gson();
List xinxi=gso.fromJson(line, List.class);
我Java这样写但是报错
错误信息是:
Expected BEGIN_ARRAY but was STRING at line 1 column 1
解决方案
你的line是result里的值吗,而不是你上面整个json
时间: 2024-12-02 01:13:37