数据库中这个JSON 格式的 怎么解析

[{"count":"3","ID":"3","type":"fd"}] 就是 点击修改的时候 修改页面会出现
ID COUNT TYPE 这三个属性 属性下面对应
3 3 fd
这样的 。急急急急急急

json格式按照json格式解析出来,然后对应赋值在拼接为字符串,然后存储起来就OK
比如说String result ={"ID":"1"};
JSONObject jsonObject= new JSONObject(result);
String id=jsonObject.getString("ID");
这样就拿到ID的值了,如果需要修改ID=3,则只需要重新封装为json,这里不再写

中括号代表jsonArray,大括号代表JSONObject

可以把你数据库中的json变成map或者list然后不就可以操作了嘛

能给个具体的代码给我看看嘛String [] randomItemIdArray = randomPacksVO.getRandomItemId().split(",");
String [] randomItemRateArray = randomPacksVO.getRandomItemRate().split(",");
JSONArray jsonarray = new JSONArray();
for(int i = 0;i<randomItemIdArray.length;i++){
JSONObject json = new JSONObject();
json.put("id", randomItemIdArray[i]);
json.put("rate", randomItemRateArray[i]);
jsonarray.add(json);

}
String randomItemJson = jsonarray.toString();
System.out.print("randomItemJson:"+ randomItemJson);
randomPacksVO.setRandomItem(randomItemJson);
randomPacksService.insertRandomPacksVO(randomPacksVO); 这个是 存入JSON 数据

能写个具体代码吗 急急急!

JsonArray array = new JsonArray(jsonStr);
JsonObject object = array.getJSONObject(0);
String count = object.getString("count");
String ID = object.getString("ID");
String type = object.getString("type");

参考:http://blog.csdn.net/molashaonian/article/details/50133153

            String json = "[{\"count\":\"3\",\"ID\":\"3\",\"type\":\"fd\"}]";
    try {
        JSONArray jsonArray = new JSONArray(json);
        for (int i = 0; i < jsonArray.length(); i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            int count = jsonObject.getInt("count");
            String id = jsonObject.getString("ID");
            String type = jsonObject.getString("type");
            // 如此现在已经拿到数据了,往下不再说,核心代码已经给你
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

对了这里用的json包是org打头的,不要用成net打头的包,net呢个是封装json用的,org是解析json用的OK?

还有一种写法比较专业点,等会给你

比较专业点的写法是写一个Java Bean结构,一个JSONObject其实就是一个Java bean,对应起来,这样不论调用还是复用都比较方便,