- 浏览: 138030 次
文章分类
最新评论
FastJSON是一个很好的java开源json工具类库,相比其他同类的json类库,它的速度的确是fast,最快!但是文档做得不好,在应用前不得不亲测一些功能。
实际上其他的json处理工具都和它差不多,api也有几分相似。
一、JSON规范
JSON是一个标准规范,用于数据交互,规范的中文文档如下:
参看规范,来对比JSON类库处理结果。
二、fastjson的一些简要说明
1、了解fastjson
Fastjson介绍
Fastjson是一个Java语言编写的JSON处理器。
1、遵循http://json.org标准,为其官方网站收录的参考实现之一。
2、功能qiang打,支持JDK的各种类型,包括基本的JavaBean、Collection、Map、Date、Enum、泛型。
3、无依赖,不需要例外额外的jar,能够直接跑在JDK上。
4、开源,使用Apache License 2.0协议开源。http://code.alibabatech.com/wiki/display/FastJSON/Home
1、遵循http://json.org标准,为其官方网站收录的参考实现之一。
2、功能qiang打,支持JDK的各种类型,包括基本的JavaBean、Collection、Map、Date、Enum、泛型。
3、无依赖,不需要例外额外的jar,能够直接跑在JDK上。
4、开源,使用Apache License 2.0协议开源。http://code.alibabatech.com/wiki/display/FastJSON/Home
如果获得Fastjson?
SVN:http://code.alibabatech.com/svn/fastjson/trunk/
WIKI:http://code.alibabatech.com/wiki/display/FastJSON/Home
Issue Tracking:http://code.alibabatech.com/jira/browse/FASTJSON
SVN:http://code.alibabatech.com/svn/fastjson/trunk/
WIKI:http://code.alibabatech.com/wiki/display/FastJSON/Home
Issue Tracking:http://code.alibabatech.com/jira/browse/FASTJSON
2、主要的使用入口
Fastjson API入口类是com.alibaba.fastjson.JSON,常用的序列化操作都可以在JSON类上的静态方法直接完成。
public static final Object parse(String text); // 把JSON文本parse为JSONObject或者JSONArray
public static final JSONObject parseObject(String text); // 把JSON文本parse成JSONObject
public static final <T> T parseObject(String text, Class<T> clazz); // 把JSON文本parse为JavaBean
public static final JSONArray parseArray(String text); // 把JSON文本parse成JSONArray
public static final <T> List<T> parseArray(String text, Class<T> clazz); //把JSON文本parse成JavaBean集合
public static final String toJSONString(Object object); // 将JavaBean序列化为JSON文本
public static final String toJSONString(Object object, boolean prettyFormat); // 将JavaBean序列化为带格式的JSON文本
public static final Object toJSON(Object javaObject); 将JavaBean转换为JSONObject或者JSONArray。
public static final JSONObject parseObject(String text); // 把JSON文本parse成JSONObject
public static final <T> T parseObject(String text, Class<T> clazz); // 把JSON文本parse为JavaBean
public static final JSONArray parseArray(String text); // 把JSON文本parse成JSONArray
public static final <T> List<T> parseArray(String text, Class<T> clazz); //把JSON文本parse成JavaBean集合
public static final String toJSONString(Object object); // 将JavaBean序列化为JSON文本
public static final String toJSONString(Object object, boolean prettyFormat); // 将JavaBean序列化为带格式的JSON文本
public static final Object toJSON(Object javaObject); 将JavaBean转换为JSONObject或者JSONArray。
3、有关类库的一些说明
SerializeWriter:相当于StringBuffer
JSONArray:相当于List<Object>
JSONObject:相当于Map<String, Object>
JSON反序列化没有真正数组,本质类型都是List<Object>
4、fastjson还有很多很高级的特性,比如支持注解、支持全类型序列化,这些都是很好的特性,功能强大,不在本次测试范围。
三、测试代码
package lavasoft.stu.json;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.util.*;
/**
* Created by IntelliJ IDEA.
*
* @author leizhimin 11-11-22 上午9:15
*/
public class Foo {
private String vString = "vStringhehhehe";
private char vchar = 'x';
private byte vbyte = 64;
private short vshort = 128;
private int vint = 65535;
private long vlong = 9999999L;
private float vfloat = 12.1f;
private double vdouble = 22.203d;
private boolean vboolean = false;
// private Date vdate = new Date();
private Date dddd = new Date();
private Date vDate = new Date();
private Date v_Date = new Date();
private Object vnull = null;
private String[] avString = {"aaa", "bbb", "ccc"};
private int[] avint = {1, 2, 3, 4};
private boolean[] avboolean = {true, false, true, true};
private List<String> listString = new ArrayList<String>();
private Map<String, String> map = new HashMap<String, String>();
private Bar bar = new Bar();
private Bar[] avBar = {new Bar(), new Bar()};
private List<Bar> listBar = new ArrayList<Bar>();
{
listString.add("listString1");
listString.add("listString2");
listString.add("listString3");
map.put("x", "s11111x");
map.put("y", "s22222y");
map.put("z", "s33333z");
listBar.add(new Bar());
listBar.add(new Bar());
listBar.add(new Bar());
}
public String getvString() {
return vString;
}
public void setvString(String vString) {
this.vString = vString;
}
public char getVchar() {
return vchar;
}
public void setVchar(char vchar) {
this.vchar = vchar;
}
public byte getVbyte() {
return vbyte;
}
public void setVbyte(byte vbyte) {
this.vbyte = vbyte;
}
public short getVshort() {
return vshort;
}
public void setVshort(short vshort) {
this.vshort = vshort;
}
public int getVint() {
return vint;
}
public void setVint(int vint) {
this.vint = vint;
}
public long getVlong() {
return vlong;
}
public void setVlong(long vlong) {
this.vlong = vlong;
}
public float getVfloat() {
return vfloat;
}
public void setVfloat(float vfloat) {
this.vfloat = vfloat;
}
public double getVdouble() {
return vdouble;
}
public void setVdouble(double vdouble) {
this.vdouble = vdouble;
}
public boolean isVboolean() {
return vboolean;
}
public void setVboolean(boolean vboolean) {
this.vboolean = vboolean;
}
public Date getDddd() {
return dddd;
}
public void setDddd(Date dddd) {
this.dddd = dddd;
}
public Date getV_Date() {
return v_Date;
}
public void setV_Date(Date v_Date) {
this.v_Date = v_Date;
}
public Date getvDate() {
return vDate;
}
public void setvDate(Date vDate) {
this.vDate = vDate;
}
public Object getVnull() {
return vnull;
}
public void setVnull(Object vnull) {
this.vnull = vnull;
}
public String[] getAvString() {
return avString;
}
public void setAvString(String[] avString) {
this.avString = avString;
}
public int[] getAvint() {
return avint;
}
public void setAvint(int[] avint) {
this.avint = avint;
}
public boolean[] getAvboolean() {
return avboolean;
}
public void setAvboolean(boolean[] avboolean) {
this.avboolean = avboolean;
}
public List<String> getListString() {
return listString;
}
public void setListString(List<String> listString) {
this.listString = listString;
}
public Map<String, String> getMap() {
return map;
}
public void setMap(Map<String, String> map) {
this.map = map;
}
public Bar getBar() {
return bar;
}
public void setBar(Bar bar) {
this.bar = bar;
}
public Bar[] getAvBar() {
return avBar;
}
public void setAvBar(Bar[] avBar) {
this.avBar = avBar;
}
public List<Bar> getListBar() {
return listBar;
}
public void setListBar(List<Bar> listBar) {
this.listBar = listBar;
}
}
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.util.*;
/**
* Created by IntelliJ IDEA.
*
* @author leizhimin 11-11-22 上午9:15
*/
public class Foo {
private String vString = "vStringhehhehe";
private char vchar = 'x';
private byte vbyte = 64;
private short vshort = 128;
private int vint = 65535;
private long vlong = 9999999L;
private float vfloat = 12.1f;
private double vdouble = 22.203d;
private boolean vboolean = false;
// private Date vdate = new Date();
private Date dddd = new Date();
private Date vDate = new Date();
private Date v_Date = new Date();
private Object vnull = null;
private String[] avString = {"aaa", "bbb", "ccc"};
private int[] avint = {1, 2, 3, 4};
private boolean[] avboolean = {true, false, true, true};
private List<String> listString = new ArrayList<String>();
private Map<String, String> map = new HashMap<String, String>();
private Bar bar = new Bar();
private Bar[] avBar = {new Bar(), new Bar()};
private List<Bar> listBar = new ArrayList<Bar>();
{
listString.add("listString1");
listString.add("listString2");
listString.add("listString3");
map.put("x", "s11111x");
map.put("y", "s22222y");
map.put("z", "s33333z");
listBar.add(new Bar());
listBar.add(new Bar());
listBar.add(new Bar());
}
public String getvString() {
return vString;
}
public void setvString(String vString) {
this.vString = vString;
}
public char getVchar() {
return vchar;
}
public void setVchar(char vchar) {
this.vchar = vchar;
}
public byte getVbyte() {
return vbyte;
}
public void setVbyte(byte vbyte) {
this.vbyte = vbyte;
}
public short getVshort() {
return vshort;
}
public void setVshort(short vshort) {
this.vshort = vshort;
}
public int getVint() {
return vint;
}
public void setVint(int vint) {
this.vint = vint;
}
public long getVlong() {
return vlong;
}
public void setVlong(long vlong) {
this.vlong = vlong;
}
public float getVfloat() {
return vfloat;
}
public void setVfloat(float vfloat) {
this.vfloat = vfloat;
}
public double getVdouble() {
return vdouble;
}
public void setVdouble(double vdouble) {
this.vdouble = vdouble;
}
public boolean isVboolean() {
return vboolean;
}
public void setVboolean(boolean vboolean) {
this.vboolean = vboolean;
}
public Date getDddd() {
return dddd;
}
public void setDddd(Date dddd) {
this.dddd = dddd;
}
public Date getV_Date() {
return v_Date;
}
public void setV_Date(Date v_Date) {
this.v_Date = v_Date;
}
public Date getvDate() {
return vDate;
}
public void setvDate(Date vDate) {
this.vDate = vDate;
}
public Object getVnull() {
return vnull;
}
public void setVnull(Object vnull) {
this.vnull = vnull;
}
public String[] getAvString() {
return avString;
}
public void setAvString(String[] avString) {
this.avString = avString;
}
public int[] getAvint() {
return avint;
}
public void setAvint(int[] avint) {
this.avint = avint;
}
public boolean[] getAvboolean() {
return avboolean;
}
public void setAvboolean(boolean[] avboolean) {
this.avboolean = avboolean;
}
public List<String> getListString() {
return listString;
}
public void setListString(List<String> listString) {
this.listString = listString;
}
public Map<String, String> getMap() {
return map;
}
public void setMap(Map<String, String> map) {
this.map = map;
}
public Bar getBar() {
return bar;
}
public void setBar(Bar bar) {
this.bar = bar;
}
public Bar[] getAvBar() {
return avBar;
}
public void setAvBar(Bar[] avBar) {
this.avBar = avBar;
}
public List<Bar> getListBar() {
return listBar;
}
public void setListBar(List<Bar> listBar) {
this.listBar = listBar;
}
}
package lavasoft.stu.json;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.util.Date;
import java.util.Random;
/**
* Created by IntelliJ IDEA.
*
* @author leizhimin 11-11-22 上午9:15
*/
public class Bar {
public static SerializeConfig mapping = new SerializeConfig();
private String barName;
private int barAge;
private Date barDate = new Date();
static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
}
{
Random r = new Random();
barName = "sss_"+String.valueOf(r.nextFloat());
barAge = r.nextInt();
}
public static void main(String[] args) {
Object obj = JSON.toJSON(new Bar());
String x1 = JSON.toJSONString(new Bar(), true);
System.out.println(x1);
String x2 = JSON.toJSONString(new Bar(), mapping);
System.out.println(x2);
}
public String getBarName() {
return barName;
}
public void setBarName(String barName) {
this.barName = barName;
}
public int getBarAge() {
return barAge;
}
public void setBarAge(int barAge) {
this.barAge = barAge;
}
public Date getBarDate() {
return barDate;
}
public void setBarDate(Date barDate) {
this.barDate = barDate;
}
@Override
public String toString() {
return "Bar{" +
"barName='" + barName + '\'' +
", barAge=" + barAge +
", barDate=" + barDate +
'}';
}
}
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.util.Date;
import java.util.Random;
/**
* Created by IntelliJ IDEA.
*
* @author leizhimin 11-11-22 上午9:15
*/
public class Bar {
public static SerializeConfig mapping = new SerializeConfig();
private String barName;
private int barAge;
private Date barDate = new Date();
static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
}
{
Random r = new Random();
barName = "sss_"+String.valueOf(r.nextFloat());
barAge = r.nextInt();
}
public static void main(String[] args) {
Object obj = JSON.toJSON(new Bar());
String x1 = JSON.toJSONString(new Bar(), true);
System.out.println(x1);
String x2 = JSON.toJSONString(new Bar(), mapping);
System.out.println(x2);
}
public String getBarName() {
return barName;
}
public void setBarName(String barName) {
this.barName = barName;
}
public int getBarAge() {
return barAge;
}
public void setBarAge(int barAge) {
this.barAge = barAge;
}
public Date getBarDate() {
return barDate;
}
public void setBarDate(Date barDate) {
this.barDate = barDate;
}
@Override
public String toString() {
return "Bar{" +
"barName='" + barName + '\'' +
", barAge=" + barAge +
", barDate=" + barDate +
'}';
}
}
package lavasoft.stu.json;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.util.*;
/**
* Created by 2IntelliJ IDEA.
*
* @author leizhimin 11-11-22 上午9:45
*/
public class Test {
private static SerializeConfig mapping = new SerializeConfig(); static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
}
public static void main(String[] args) {
Foo f1 = new Foo();
Date date = new Date();
String text = JSON.toJSONString(date, mapping);
System.out.println(text);
System.out.println(JSON.toJSONString(f1, true));
String x2 =JSON.toJSONString(f1, mapping);
System.out.println(x2);
}
public static void json2List(){
//List -> JSON array
List<Bar> barList = new ArrayList<Bar>();
barList.add(new Bar());
barList.add(new Bar());
barList.add(new Bar());
String json= JSON.toJSONString(barList, true);
System.out.println(json);
//JSON array -> List
List<Bar> barList1 = JSON.parseArray(json,Bar.class);
for (Bar bar : barList1) {
System.out.println(bar.toString());
}
}
public static void json2Map(){
//Map -> JSON
Map<String,Bar> map = new HashMap<String, Bar>();
map.put("a",new Bar());
map.put("b",new Bar());
map.put("c",new Bar());
String json = JSON.toJSONString(map,true);
System.out.println(json);
//JSON -> Map
Map<String,Bar> map1 = (Map<String,Bar>)JSON.parse(json);
for (String key : map1.keySet()) {
System.out.println(key+":"+map1.get(key));
}
}
public static void array2JSON(){
String[] arr_String = {"a","b","c"};
String json_arr_String = JSON.toJSONString(arr_String,true);
System.out.println(json_arr_String);
JSONArray jsonArray = JSON.parseArray(json_arr_String);
for (Object o : jsonArray) {
System.out.println(o);
}
System.out.println(jsonArray);
}
public static void array2JSON2(){
Bar[] arr_Bar = {new Bar(),new Bar(),new Bar()};
String json_arr_Bar = JSON.toJSONString(arr_Bar,true);
System.out.println(json_arr_Bar);
JSONArray jsonArray = JSON.parseArray(json_arr_Bar);
for (Object o : jsonArray) {
System.out.println(o);
}
System.out.println(jsonArray);
}
public static void map2JSON(){
Map map = new HashMap();
map.put("a","aaa");
map.put("b","bbb");
map.put("c","ccc");
String json=JSON.toJSONString(map);
System.out.println(json);
Map map1 = JSON.parseObject(json);
for (Object o : map.entrySet()) {
Map.Entry<String,String> entry = (Map.Entry<String,String>)o;
System.out.println(entry.getKey()+"--->"+entry.getValue());
}
}
}
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.util.*;
/**
* Created by 2IntelliJ IDEA.
*
* @author leizhimin 11-11-22 上午9:45
*/
public class Test {
private static SerializeConfig mapping = new SerializeConfig(); static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
}
public static void main(String[] args) {
Foo f1 = new Foo();
Date date = new Date();
String text = JSON.toJSONString(date, mapping);
System.out.println(text);
System.out.println(JSON.toJSONString(f1, true));
String x2 =JSON.toJSONString(f1, mapping);
System.out.println(x2);
}
public static void json2List(){
//List -> JSON array
List<Bar> barList = new ArrayList<Bar>();
barList.add(new Bar());
barList.add(new Bar());
barList.add(new Bar());
String json= JSON.toJSONString(barList, true);
System.out.println(json);
//JSON array -> List
List<Bar> barList1 = JSON.parseArray(json,Bar.class);
for (Bar bar : barList1) {
System.out.println(bar.toString());
}
}
public static void json2Map(){
//Map -> JSON
Map<String,Bar> map = new HashMap<String, Bar>();
map.put("a",new Bar());
map.put("b",new Bar());
map.put("c",new Bar());
String json = JSON.toJSONString(map,true);
System.out.println(json);
//JSON -> Map
Map<String,Bar> map1 = (Map<String,Bar>)JSON.parse(json);
for (String key : map1.keySet()) {
System.out.println(key+":"+map1.get(key));
}
}
public static void array2JSON(){
String[] arr_String = {"a","b","c"};
String json_arr_String = JSON.toJSONString(arr_String,true);
System.out.println(json_arr_String);
JSONArray jsonArray = JSON.parseArray(json_arr_String);
for (Object o : jsonArray) {
System.out.println(o);
}
System.out.println(jsonArray);
}
public static void array2JSON2(){
Bar[] arr_Bar = {new Bar(),new Bar(),new Bar()};
String json_arr_Bar = JSON.toJSONString(arr_Bar,true);
System.out.println(json_arr_Bar);
JSONArray jsonArray = JSON.parseArray(json_arr_Bar);
for (Object o : jsonArray) {
System.out.println(o);
}
System.out.println(jsonArray);
}
public static void map2JSON(){
Map map = new HashMap();
map.put("a","aaa");
map.put("b","bbb");
map.put("c","ccc");
String json=JSON.toJSONString(map);
System.out.println(json);
Map map1 = JSON.parseObject(json);
for (Object o : map.entrySet()) {
Map.Entry<String,String> entry = (Map.Entry<String,String>)o;
System.out.println(entry.getKey()+"--->"+entry.getValue());
}
}
}
说明:
SerializeConfig:是对序列化过程中一些序列化过程的特殊配置,这里用作日期格式的定义。
有关需要带类型的全类型序列化过程,需要调用JSON.toJSONStringZ()方法。
需要美化输出时候,需要打开序列化美化开关,在方法中true那个参数。
输出结果:
"2011-11-23 23:30:33"
{
"avBar":[{
"barAge":174398800,
"barDate":1322062233062,
"barName":"sss_0.62378174"
},{
"barAge":38938962,
"barDate":1322062233062,
"barName":"sss_0.36014742"
}],
"avString":["aaa","bbb","ccc"],
"avboolean":[true,false,true,true],
"avint":[1,2,3,4],
"bar":{
"barAge":1601495948,
"barDate":1322062233062,
"barName":"sss_0.46644872"
},
"dddd":1322062233046,
"listBar":[
{
"barAge":-1090113522,
"barDate":1322062233062,
"barName":"sss_0.83562374"
},
{
"barAge":478603194,
"barDate":1322062233062,
"barName":"sss_0.59483266"
},
{
"barAge":1118357669,
"barDate":1322062233062,
"barName":"sss_0.9961642"
}
],
"listString":[
"listString1",
"listString2",
"listString3"
],
"map":{"x":"s11111x","y":"s22222y","z":"s33333z"},
"v_Date":1322062233046,
"vboolean":false,
"vbyte":64,
"vchar":"x",
"vdouble":22.203,
"vfloat":12.1,
"vint":65535,
"vlong":9999999,
"vshort":128
}
{"avBar":[{"barAge":174398800,"barDate":"2011-11-23 23:30:33","barName":"sss_0.62378174"},{"barAge":38938962,"barDate":"2011-11-23 23:30:33","barName":"sss_0.36014742"}],"avString":["aaa","bbb","ccc"],"avboolean":[true,false,true,true],"avint":[1,2,3,4],"bar":{"barAge":1601495948,"barDate":"2011-11-23 23:30:33","barName":"sss_0.46644872"},"dddd":"2011-11-23 23:30:33","listBar":[{"barAge":-1090113522,"barDate":"2011-11-23 23:30:33","barName":"sss_0.83562374"},{"barAge":478603194,"barDate":"2011-11-23 23:30:33","barName":"sss_0.59483266"},{"barAge":1118357669,"barDate":"2011-11-23 23:30:33","barName":"sss_0.9961642"}],"listString":["listString1","listString2","listString3"],"map":{"x":"s11111x","y":"s22222y","z":"s33333z"},"v_Date":"2011-11-23 23:30:33","vboolean":false,"vbyte":64,"vchar":"x","vdouble":22.203,"vfloat":12.1,"vint":65535,"vlong":9999999,"vshort":128}
Process finished with exit code 0
{
"avBar":[{
"barAge":174398800,
"barDate":1322062233062,
"barName":"sss_0.62378174"
},{
"barAge":38938962,
"barDate":1322062233062,
"barName":"sss_0.36014742"
}],
"avString":["aaa","bbb","ccc"],
"avboolean":[true,false,true,true],
"avint":[1,2,3,4],
"bar":{
"barAge":1601495948,
"barDate":1322062233062,
"barName":"sss_0.46644872"
},
"dddd":1322062233046,
"listBar":[
{
"barAge":-1090113522,
"barDate":1322062233062,
"barName":"sss_0.83562374"
},
{
"barAge":478603194,
"barDate":1322062233062,
"barName":"sss_0.59483266"
},
{
"barAge":1118357669,
"barDate":1322062233062,
"barName":"sss_0.9961642"
}
],
"listString":[
"listString1",
"listString2",
"listString3"
],
"map":{"x":"s11111x","y":"s22222y","z":"s33333z"},
"v_Date":1322062233046,
"vboolean":false,
"vbyte":64,
"vchar":"x",
"vdouble":22.203,
"vfloat":12.1,
"vint":65535,
"vlong":9999999,
"vshort":128
}
{"avBar":[{"barAge":174398800,"barDate":"2011-11-23 23:30:33","barName":"sss_0.62378174"},{"barAge":38938962,"barDate":"2011-11-23 23:30:33","barName":"sss_0.36014742"}],"avString":["aaa","bbb","ccc"],"avboolean":[true,false,true,true],"avint":[1,2,3,4],"bar":{"barAge":1601495948,"barDate":"2011-11-23 23:30:33","barName":"sss_0.46644872"},"dddd":"2011-11-23 23:30:33","listBar":[{"barAge":-1090113522,"barDate":"2011-11-23 23:30:33","barName":"sss_0.83562374"},{"barAge":478603194,"barDate":"2011-11-23 23:30:33","barName":"sss_0.59483266"},{"barAge":1118357669,"barDate":"2011-11-23 23:30:33","barName":"sss_0.9961642"}],"listString":["listString1","listString2","listString3"],"map":{"x":"s11111x","y":"s22222y","z":"s33333z"},"v_Date":"2011-11-23 23:30:33","vboolean":false,"vbyte":64,"vchar":"x","vdouble":22.203,"vfloat":12.1,"vint":65535,"vlong":9999999,"vshort":128}
Process finished with exit code 0
fastjson通过各方面测试都很好,功能性能都是No.1,喜欢,它的源代码质量很高,作者也煞费苦心,将性能做到了最好,全免超越其他的json类库。
从其中的源代码中,可以学到很多东西,在阅读源码后,不得不佩服作者高超的程序设计水平,和高质量的编码。
发表评论
-
java中把对象、对象bean、list集合、对象数组、Map和Set以及字符串转换成Json
2013-05-13 13:13 1253主要实现把java对常用的一些数据转换成Json,以便前台的 ... -
(转载)Java Socket实战之五:使用加密协议传输对象
2013-01-07 16:38 646前面几篇博文提到了Socket中一些常用的用法,但是对于一些有 ... -
(转载)Java Socket实战之四:传输压缩对象
2013-01-07 16:28 598上一篇文章说到了用Java Socket来传输对象,但是在有 ... -
(转载)Java Socket实战之三:传输对象
2013-01-07 16:25 684前面两篇文章介绍了怎样建立Java Socket通信,这一篇 ... -
(转载)Java Socket实战之二:多线程通信
2013-01-07 16:23 1005说到怎样写一个最简单的Java Socket通信,但是在上一 ... -
(转载)Java Socket实战之一:单线程通信
2013-01-07 15:46 683现在做Java直接使用Socket的情况是越来越少,因为有很 ... -
map的三种遍历方法!
2012-12-20 16:54 643map的三种遍历方法! 集合的一个很重要的操 ... -
JAVA数组的定义及使用方法
2012-12-13 11:34 777数组是有序数据的集合,数组中的每个元素具有相同的数组名和下标来 ... -
(转载)FTP文件上传与下载
2012-12-06 15:14 821实现FTP文件上传与下载可以通过以下两种种方式实现(不知道还有 ... -
ORA-01460: 转换请求无法实现或不合理
2012-11-27 17:27 3923oracle10g数据库执行数据库更新sql时报错: Cau ... -
配置TOMCAT(,JAVA_HOMECATALINA_HOME,CLASSPATH)环境变量
2012-11-18 15:42 4687配置TOMCAT(,JAVA_HOMECATALI ... -
(转载)验证码无法显示:Could not initialize class sun.awt.X1 解决方案
2012-11-16 14:41 689网站验证码突然无法显示,并报如下错误。 Caused by: ... -
(转载)linux 下tomcat 报java.lang.OutOfMemoryError: PermGen space及其解决方法
2012-11-16 11:20 632PermGen space的全称是Permanent Gene ... -
JSP内置对象
2012-11-13 15:42 5711.request对象 客户端的请求信息被封装 ... -
用Java删除文件夹里的所有文件
2012-11-11 15:27 838import java.io.File;publ ... -
通过Java几行代码截取屏幕
2012-11-11 15:25 570通过java.awt.Robot的createScreenCa ... -
oracle日期类型字段的操作
2012-10-26 09:32 693在java对oracle的操作中 ... -
验证码无法显示:Could not initialize class sun.awt.X1 解决方案
2012-10-22 11:10 1012网站验证码突然无法显示,并报如下错误。 Caused by: ... -
http协议-简介
2012-09-29 17:43 768一、简介 超文本传输 ... -
java socket编程
2012-09-29 17:41 571一,网络编程中两个 ...
相关推荐
**FastJson:一个高效、强大的Java JSON库** FastJson是阿里巴巴开源的一款高性能的JSON库,它主要用于Java对象与JSON字符串之间的转换。在这个小例子中,我们将深入探讨FastJson的使用方法,以及它如何帮助开发者...
《深入理解Fastjson:阿里巴巴的高效JSON库》 在当今的软件开发中,JSON作为一种轻量级的数据交换格式,被广泛应用于服务器与客户端之间的数据传输。而Fastjson,由阿里巴巴公司开发,是一款性能优秀且易用的Java...
《FastJsonJar:Java开发中的高效JSON处理库》 FastJsonJar,正如其名,是一个专为Java开发者设计的高效JSON解析和生成工具。在现代Web服务和移动应用开发中,JSON作为数据交换格式,其使用频率之高不言而喻。...
在Android开发中,数据交换和序列化是常见的需求,FastJSON是阿里巴巴提供的一款高效、功能丰富的JSON库,它被广泛应用于Android Studio项目中。本文将详细介绍如何在Android Studio中使用FastJSON进行JSON解析和...
**Fastjson:一个高效、强大的Java JSON库** Fastjson是阿里巴巴开发的一个开源项目,它是一个Java语言编写的高性能功能完备的JSON库。Fastjson能够将Java对象转换为JSON字符串,也能将JSON内容转换为对应的Java...
fastjson-1.1.35.jar ,fastjson-1.1.36.jar ,fastjson-1.1.37.jar ,fastjson-1.1.44.jar ,fastjson-1.2.3.jar,fastjson-1.2.4.jar
赠送jar包:fastjson-1.2.54.jar; 赠送原API文档:fastjson-1.2.54-javadoc.jar; 赠送源代码:fastjson-1.2.54-sources.jar; 赠送Maven依赖信息文件:fastjson-1.2.54.pom; 包含翻译后的API文档:fastjson-...
赠送jar包:fastjson-1.2.51.jar; 赠送原API文档:fastjson-1.2.51-javadoc.jar; 赠送源代码:fastjson-1.2.51-sources.jar; 赠送Maven依赖信息文件:fastjson-1.2.51.pom; 包含翻译后的API文档:fastjson-...
fastjson-1.2.31的官方jar包合集【fastjson-1.2.31.jar,fastjson-1.2.31-sources.jar,fastjson-1.2.31-sources.jar】,还包括源码source,和文档。
标题中的“fastjson定制工程,别名配置化”指的是对Fastjson库的扩展,使其能够支持动态配置字段别名,而不是像原生Fastjson那样只能硬编码(hardcode)在代码中。这样的改进对于处理与第三方接口交互时,字段名称...
fastjson-1.2.83.jar下载,fastjson是阿里巴巴的开源JSON解析库,可以解析JSON格式的字符串,支持将Java Bean序列化为JSON字符串,也支持从JSON字符串反序列化到JavaBean。fastjson采用全新的JSON解析算法,运行速度极快...
赠送jar包:fastjson-1.2.72.jar; 赠送原API文档:fastjson-1.2.72-javadoc.jar; 赠送源代码:fastjson-1.2.72-sources.jar; 赠送Maven依赖信息文件:fastjson-1.2.72.pom; 包含翻译后的API文档:fastjson-1.2....
**Fastjson 深度解析** Fastjson 是阿里巴巴开发的一款高效、功能强大的 JSON 解析库,广泛应用于 Java 开发环境中。其主要特点是性能优异,易用性好,且具有丰富的功能,使得它在处理 JSON 数据时能提供极高的效率...
Fastjson是阿里巴巴开发的一款高效、功能丰富的JSON库,主要用于Java平台。它提供了快速解析和生成JSON的能力,使得在Java程序中处理JSON数据变得极其便捷。这个"Alibaba Fastjson Jar包.zip"文件包含了Fastjson库的...
《深入解析Fastjson 1.2.66版本》 Fastjson是阿里巴巴开源的一个高性能的JSON库,它在Java世界中被广泛使用,为开发者提供了快速、方便地处理JSON数据的能力。Fastjson 1.2.66是该库的一个稳定版本,其核心功能包括...
赠送jar包:fastjson-1.2.17.jar; 赠送原API文档:fastjson-1.2.17-javadoc.jar; 赠送源代码:fastjson-1.2.17-sources.jar; 赠送Maven依赖信息文件:fastjson-1.2.17.pom; 包含翻译后的API文档:fastjson-...
《深入解析Fastjson-1.2.9版》 Fastjson是阿里巴巴开发的一款高效、功能强大的JSON库,广泛应用于Java编程环境中。它以其简洁的API、卓越的性能和丰富的功能,成为了许多开发者处理JSON数据的首选工具。在Fastjson-...
快速JSON(Fastjson)是阿里巴巴开发的一个高性能的Java JSON库,它能解析JSON格式的数据,并将其转换为Java对象,反之亦然。Fastjson以其高效、轻量级的特点,在Java开发中广泛应用于数据交换和序列化场景。这个...
阿里Fastjson是一个高性能的Java JSON库,由阿里巴巴公司开发并维护。它被广泛应用于各种Java项目中,尤其在数据解析和序列化方面表现卓越。Fastjson的命名来源于"Fast Java Object to JSON",即快速地将Java对象...
**Fastjson 深度解析** Fastjson 是阿里巴巴开源的一款高效、功能强大的 JSON 库,它主要用于 Java 和 Android 平台。在标题“fastjson1.2.2.rar”和描述中,我们可以推断出这是一个关于 Fastjson 版本 1.2.2 的...