mr-wuxiansheng
 

java解析json数组

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public static void main(String[] args) throws JSONException {   String sJson = "[{\'gwcxxid\':\'1\',\'spsl\':\'2\'},{\'gwcxxid\':\'1\',\'spsl\':\'2\'},{\'gwcxxid\':\'3\',\'spsl\':\'4\'}]";   JSONArray jsonArray = new JSONArray(sJson);   int iSize = jsonArray.length();   System.out.println("Size:" + iSize);   for (int i = 0; i < iSize; i++) {         JSONObject jsonObj = jsonArray.getJSONObject(i);         System.out.println("[" + i + "]gwcxxid=" + jsonObj.get("gwcxxid"));         System.out.println("[" + i + "]spsl=" + jsonObj.get("spsl"));         System.out.println();     } }

 

分类:

技术点:

相关文章:

  • 2021-11-18
  • 2021-11-18
  • 2021-11-30
  • 2021-11-17
  • 2021-11-30
  • 2022-01-09
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2021-08-05
  • 2021-11-17
  • 2021-09-30
  • 2021-11-18
相关资源
相似解决方案