java解析json字符串

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();

		}

	}

java解析json字符串 数据

你可能感兴趣的:(java解析json字符串)