Json与Object转换
Json与Object转换
依赖jar包:fastjson
<dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.75</version>
</dependency>Object转Json
User user=new User();
String json=JSON.toJSONString(user);Json转Object
String json="User{id=60223, name='neo', address='静安华山路250号'";
Hotel hotel = JSON.parseObject(json, Hotel.class);

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号