2024-11-30 14:28:49
这是一个json数组格式的
public static void main(String[] args) {
String str = "[{\"monthincome\":\"2.85\",\"endasset\":\"15.33\"}"+
",{\"monthincome\":\"3.85\",\"endasset\":\"2.33\"}"+
",{\"monthincome\":\"3.85\",\"endasset\":\"3.33\"}]";
com.alibaba.fastjson.JSONArray jsonArray = JSONArray.parseArray(str);
for(int i = 0 ; i < jsonArray.size() ; i++){
com.alibaba.fastjson.JSONObject jsonObject= JSONObject.parseObject(jsonArray.getString(i));
System.out.println(jsonObject.get("monthincome"));
}
}