黎明前的黑暗
一切不行都是人不行
        String objectStr="{\"namE\":\"JSON\",\"age\":\"24\",\"address\":\"北京市西城区\"}";
      
        JsonConfig config=new JsonConfig();
        config.setRootClass(StudentModel.class);

        PropertyNameProcessor lowerCasePropertyNameProcessor = new PropertyNameProcessor() {
            @Override
            public String processPropertyName(Class aClass, String s) {
                return s.toLowerCase();
            }
        };
        config.registerJavaPropertyNameProcessor(StudentModel.class, lowerCasePropertyNameProcessor);
        JSONObject jsonObject=JSONObject.fromObject(objectStr);
        StudentModel stu=(StudentModel)JSONObject.toBean(jsonObject,config);

 

posted on 2019-04-17 13:51  无厘头的小情绪  阅读(2340)  评论(0编辑  收藏  举报