fastJson

public class jsonTest {
    public static void main(String[] args) {
        /**
         * json字符串转化为对象
         */
        String jsonString = "{name:'Antony',age:'12',sex:'male',telephone:'88888'}";
        Staff staff = JSON.parseObject(jsonString, Staff.class);
        System.out.println(staff.toString());
 
        /**
         * 对象转化为json字符串
         */
        String jsonStr = JSON.toJSONString(staff);
        System.out.println(jsonStr);
    }
}
我凝视这恒星,等待这那场风暴,我已经准备好了
原文地址:https://www.cnblogs.com/cheng5350/p/11688494.html