import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class Fastjson1CompatibleDemo {
public static void main(String[] args) {
User user = new User("John", 25);
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
User newUser = JSON.parseObject(json, User.class, Feature.SupportAutoType);
}
}
class User {
private String name;
private int age;
public User(String name, int age) {
this.name = name;
this.age = age;
}
}