FastJson教學手冊login
FastJson教學手冊
作者:php.cn  更新時間:2022-04-19 14:33:02

Fastjson API 比較


#授權與專案URL

GsonApaceh 2.0##Jackson#https://github. com /FasterXML/jackson-core

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.11</version>
</dependency>

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.1.51.android</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.7.3</version>
</dependency>

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.6.2</version>
</dependency>

import com.alibaba.fastjson.*;

JSONObject jsonObj = JSON.parseObject(jsonStr);

import com.alibaba.fastjson.JSON;

Model model = JSON.parseObject(jsonStr, Model.class

import com.alibaba.fastjson.JSON;

Type type = new TypeReference<List<Model>>() {}.getType(); 
List<Model> list = JSON.parseObject(jsonStr, type);

import com.alibaba.fastjson.JSON;

Model model = ...; 
String jsonStr = JSON.toJSONString(model);

import com.alibaba.fastjson.JSON;

Model model = ...; 
byte[] jsonBytes = JSON.toJSONBytes(model)

import com.alibaba.fastjson.JSON;

Model model = ...; 
OutputStream os;
JSON.writeJSONString(os, model);;

import com.alibaba.fastjson.JSON;

Model model = ...; 
Writer writer = ...;
JSON.writeJSONString(writer, model);
  • ##聯絡GitHub
  • ##API## 
  • #訓練

############## ###### ####部落格######## ###########關於################################################### ###### ##############
 許可證URL
#FastjsonApaceh 2.0##https://github.com/alibaba/fastjson
## https ://github.com/google/gson
Apaceh 2.0