Fastjson usage guide
Beginner’s Guide
fastjson is Alibaba’s open source JSON parsing library, which can Parse strings in JSON format, support serializing Java Beans into JSON strings, and deserializing from JSON strings to JavaBeans. Fastjson usage scenarios
Fastjson is faster than other JSON libraries. Since fastjson released version 1.1.x in 2011, its performance has never been surpassed by other JSON libraries implemented in Java.
Fastjson is used on a large scale in Alibaba and deployed on tens of thousands of servers. Fastjson is widely accepted in the industry. In 2012, it was selected as one of the most popular domestic open source software by Open Source China.
fastjson has a lot of testcases. In version 1.2.11, there are more than 3321 testcases. Regression testing will be performed on every release to ensure stable quality.
fastjson’s API is very simple.
String text = JSON.toJSONString(obj); //序列化 VO vo = JSON.parseObject("{...}", VO.class); //反序列化
Supports generics, supports stream processing of large text, supports enumeration, and supports serialization and deserialization extensions .
3. Download and use
You can download it directly from the maven central warehouse:
http://repo1.maven.org/maven2/com/alibaba/fastjson/
or configure maven dependencies
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>x.x.x</version> </dependency>
where x.x.x is the version number. You need to use a specific version to follow up. It is recommended to use the latest version.
4. android version
fastjson will release optimized versions for the android version from time to time. The android optimized version removes unnecessary code. The size is reduced and the functions are basically the same as the standard version. Released android versions include:
http://repo1.maven.org/maven2/com/alibaba/fastjson/1.1.51.android/