标签:一个 json users lib iba stat vat enc object
<!-- 阿里JSON解析器 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.68</version> </dependency>
首先引入相关jar包,
假设有一个实体类User
public class User{ private int id; private String name; }
然后通过fastJson进行类型转换
public static void main(String[] args){ String userString = "{"id":1,"name","xsl"}"; JSONObject userJson = JSONObject.parseObject(userString); User user = JSON.toJavaObject(userJson,User.class); }
标签:一个 json users lib iba stat vat enc object
原文地址:https://www.cnblogs.com/xieshilin/p/13300179.html