fastjson——enum反序列化

  • Post author:
  • Post category:其他



官方示例代码:https://github.com/alibaba/fastjson/blob/d141fa171725f1e25e5449378f8a8d8ac323c4ae/src/test/java/com/alibaba/json/bvt/issue_1500/Issue1582.java

enum Size {
    Big, Small
}

public class TestEnum {
    public static void main(String[] args) {
        Size size = JSON.parseObject("\"Big\"", Size.class);
        Size size1 = JSON.parseObject("\"Large\"", Size.class);
        System.out.println(size);
        System.out.println(size1);
    }
}


原文



https://www.blog.hiyj.cn/article/detail/70



版权声明:本文为qq_44575789原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。