Software features
·high performance·
fastjson uses an original algorithm to increase the speed of parse to the extreme, surpassing all json libraries, including jackson, which was once known as the fastest. And it also surpasses Google's binary protocol protocol buf.
·Support standards·
Fastjson fully supports the standard of http://json.org and is also one of the reference implementations included on the official website.
·Powerful function·
Supports various JDK types. Including basic types, JavaBean, Collection, Map, Enum, generics, etc.
Supports circular references
·No dependence·
There is no need for extra jars and it can run directly on the JDK.
·Wide range of support·
Supports JDK 5, JDK 6, Android, Alibaba Cloud mobile phones and other environments.
·Open Source·
Apache License 2.0
The code is hosted on github.org
·Fully tested·
fastjson has more than 1,500 testcases, which will be run every time it is built. The rich test scenarios ensure functional stability.
Content preview
Tips
maven
If you use Maven, the maven repository configuration is as follows:
Add dependencies to the pom.xml file:
serialization
The most basic functions involved in a JSON library are serialization and deserialization. Fastjson supports direct serialization of java beans. You can use the com.alibaba.fastjson.JSON class for serialization and deserialization.
basic serialization
Serialization is to convert JavaBean objects into text in JSON format.
In this example, the JSON.toJSONString method is called to convert object o into JSON-formatted text.
Use single quotes
Standard JSON uses double quotes. JavaScript supports json text in single quote format. Fastjson also supports this feature. Just turn on the SerializerFeature.UseSingleQuotes feature. For example:
There are more than a dozen SerializerFeatures that can be selected during fastjson serialization. You can choose and use them according to your own needs.
it works
it works
it works