{"3":"婚房","2":"学区房","1":"商场周边","7":"交通便利","6":"包物业费","5":"采光好","4":"小户型"}
这样的json数据如何解析 不是固定的长度 可能有8条,9条......
------解决思路----------------------
private void PaseJson() {
String json = "{\"3\":\"婚房\",\"2\":\"学区房\",\"1\":\"商场周边\",\"7\":\"交通便利\","
+ "\"6\":\"包物业费\",\"5\":\"采光好\",\"4\":\"小户型\"}";
try {
JSONObject jsonObject = new JSONObject(json);
for (Iterator<String> iterator = jsonObject.keys(); iterator
.hasNext();) {
String key = iterator.next().toString();
System.out.println(key + ":" + jsonObject.get(key));
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}