调用阿里巴巴fastjson
class User{
Integer age;
String name;
.....
}
User user1 = new User(1,"1");
Map<String, Object> param = JSONObject.parseObject(JSONObject.toJSONString(user1));
System.out.println(param);
输出:{"age":1,"name":"1"}
多用于mybatis-map多参数查询。