Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have android AsynTask method that call the Web Service which returns the List<> as shown below:
[[1,"Test",37.334542,-121.890821,-121.890821], [2,"XYZ",37.337749,-121.8867 问问题
问问题 2012-08-08T07:07:08.653 1339 次 This question shows research effort; it is useful and clear 0 This question does not show any research effort; it is unclear or not useful Bookmark this question. Show activity on this post. I have android AsynTask method that call the Web Service which returns the List<> as shown below: [[1,"Test",37.334542,-121.890821,-121.890821], [2,"XYZ",37.337749,-121.886702,-121.886702], [4,"PQR",37.336453,-121.884985,-121.884985]] Here my question is how can I convert the response of HttpResponse to List<> as same as shown above. That looks like a json response. If it is, the easiest way to do it if you have that String (jsonResponse) already is something like: JSONArray json; try { json = new JSONArray (jsonResponse); } catch (JSONException e) { //do something } You can then just use the JSONArray as is, or iterate through it and add each item to a List if you need. javaandroidjsonrestarraylist 4 1 回答 1 This answer is useful 2 这看起来像一个 json 响应。如果是这样,如果您已经拥有该字符串(jsonResponse),那么最简单的方法是: JSONArray json; try { json = new JSONArray (jsonResponse); } catch (JSONException e) { //do something } 然后,您可以按原样使用 JSONArray,或者遍历它并将每个项目添加到 aList如果需要。 于 2012-08-08T07:13:04.783 回答 Related 2 html - 使用 inline-block 未正确对齐 Div 框 7 java - 查找第二个和第三个最大元素数组java 0 c# - 在 C# 异步块中绕过全局异常处理程序 1 f# - 如果安装需要 sudo,如何编写 brew 公式? 3 php - PHP/HTML 语法错误 3 eclipse - 如何使用只有一个 GPU 的 Eclipse Nsight 调试 CUDA 1 c# - 在html c#中的所有标签之间提取单词 1 cakephp - CakePHP 2:函数 timeAgoInWords() 的本地化和内部化 3 breeze - 微风.js 如何处理安全并避免暴露业务逻辑 3 c# - 使用 OracleCommand 执行 pl/sql 函数 Reference php × 1429865 c/c++ × 756500 nginx × 49975 mongodb × 159057 mybatis × 3233 anaconda × 13410 pycharm × 14671 python × 1902243 vscode × 56040 docker × 110988 github × 49000 flask × 49129 ffmpeg × 24037 jmeter × 16910 matplotlib × 63493 bootstrap × 54641
[[1,"Test",37.334542,-121.890821,-121.890821], [2,"XYZ",37.337749,-121.886702,-121.886702], [4,"PQR",37.336453,-121.884985,-121.884985]]
Here my question is how can I convert the response of HttpResponse to List<> as same as shown above.
That looks like a json response. If it is, the easiest way to do it if you have that String (jsonResponse) already is something like:
JSONArray json; try { json = new JSONArray (jsonResponse); } catch (JSONException e) { //do something }
You can then just use the JSONArray as is, or iterate through it and add each item to a List if you need.
List
这看起来像一个 json 响应。如果是这样,如果您已经拥有该字符串(jsonResponse),那么最简单的方法是:
然后,您可以按原样使用 JSONArray,或者遍历它并将每个项目添加到 aList如果需要。