1.将json字符串转换为java对象
JSONObject obj = new JSONObject().fromObject(jsonStr);//将json字符串转换为json对象
Person jb = (Person)JSONObject.toBean(obj,Person.class);//将json对象转换为Person对象
2.将java对象转换为json字符串
JSONObject json = JSONObject.fromObject(obj);//将java对象转换为json对象
String str = json.toString();//将json对象转换为字符串