Fastjson is a high-performance and complete JSON library written in Java language. It uses an "assumed ordered fast matching" algorithm to improve the performance of JSON Parse to the extreme. It is currently the fastest JSON library in the Java language. The Fastjson interface is simple and easy to use, and has been widely used in various application scenarios such as cache serialization, protocol interaction, Web output, and Android clients.
fastjson是阿里巴巴的开源JSON解析库,它可以解析JSON格式的字符串,支持将Java Bean序列化为JSON字符串,也可以从JSON字符串反序列化到JavaBean。其目前已经被广泛应用在各种场景中,包括cache存储、RPC通讯、MQ通讯、网络协议通讯、Android客户端、Ajax服务器处理程序等等。
fastjson主要特点:
快速FAST (比其它任何基于Java的解析器和生成器更快,包括jackson)
强大(支持普通JDK类包括任意Java Bean Class、Collection、Map、Date或enum)
零依赖(没有依赖其它任何类库除了JDK)
示例代码:
import com.alibaba.fastjson.JSON; Group group = new Group(); group.setId(0L); group.setName("admin"); User guestUser = new User(); guestUser.setId(2L); guestUser.setName("guest"); User rootUser = new User(); rootUser.setId(3L); rootUser.setName("root"); group.getUsers().add(guestUser); group.getUsers().add(rootUser); String jsonString = JSON.toJSONString(group); System.out.println(jsonString);
提示:我们的fastjson教程将帮助您逐步学习如何使用fastjson,如果你有任何疑问,请前往PHP中文网fastjson社区提出你的问题,会有热心网友为你解答。
下载
android 开发者请看这里
或者通过 Maven:
com.alibaba fastjson VERSION_CODE
或者通过 Gradle:
compile 'com.alibaba:fastjson:VERSION_CODE'
用这里或者这里或者这里的真实发行版本号, 替换 VERSION_CODE , 例如 1.2.21
本fastjson教程手册涵盖的内容
本fastjson教程手册涵盖所有fastjson基础及高级知识,包含Fastjson Android版本、Fastjson 定制序列化、Fastjson 处理超大JSON文本、Fastjson 循环引用以及Fastjson 常见问题和实例的详细介绍。
提示:本教程的每一章都包含了很多代码实例,这些例子将帮助您更好地理解和使用fastjson。
Latest chapter
- Fastjson 使用实例 2017-02-20
- Fastjson Obejct/Map/JSON/String 互转 2017-02-20
- Fastjson 对象或数组转JSON 2017-02-20
- fastjson Benchmark 2017-02-20
- Fastjson BeanToArray 2017-02-20
- Fastjson API SerializeFilter 2017-02-20
- Fastjson API ParseProcess 2017-02-20
- Fastjson DataBind 2017-02-20
Related courses
- The latest ThinkPHP 5.1 world premiere video tutorial (60 days to become a PHP expert online training course) 2022-02-17
- Let's briefly talk about starting a business in PHP 2023-01-04
- Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things 2018-01-25
- Login verification and classic message board 2018-03-02
- Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum] 2022-06-28
- Quick Start Node.JS Full Version 2022-09-30
- Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance) 2022-12-08
- Horse soldier spring video tutorial 2022-04-12