web123456

Comparison of Json and FastJson

}

====================== Dividing Line

Alibaba FastJson is a Json processing toolkit , including "serialization" and "deserialization" of the two parts , it has the following characteristics :
The fastest, tests show that fastjson has a very fast performance, beyond any other Java Jsonparser. including the self-proclaimed fastest JackJson;
powerful , full support for Java Bean, collection , Map, date , Enum, support paradigm , support for introspection ; no dependencies , can run directly on Java SE5.0 or later ; support for Android ; open source (Apache 2.0)

FastjsonAPI entry class is that common serialization operations can be done directly in static methods on the JSON class.
public  static  final  Objectparse(Stringtext);  // parse JSON text to JSONObject or JSONArray.
public  static  final  JSONObjectparseObject(Stringtext);  //parse JSON text to JSONObject   
public  static  final  T parseObject(String text, Classclazz);  //parse JSON text to JavaBean
public  static  final  JSONArrayparseArray(Stringtext);  //parse JSON text into JSONArray
public  static  final  List parseArray(String text, Classclazz);  // parse JSON text into a collection of JavaBeans.
public  static  final  StringtoJSONString(Objectobject);  // Serialize JavaBean to JSON text
public  static  final  StringtoJSONString(Objectobject,  boolean  prettyFormat);  // Serialize JavaBean to formatted JSON text
public  static  final  ObjecttoJSON(Object javaObject); Convert a JavaBean to a JSONObject or JSONArray.

Second, FastJson parsing JSON steps
 
    A. Server-side conversion of data into json strings
          First, the server-side project to import Alibaba's fastjson jar package to the builtPath path (these can be downloaded from the fastjson website: /wiki/display/FastJSON/Home-zh)
The data is then converted to a json string and the core function is:
public static String createJsonString(Object value)
      {
            String alibabaJson = (value);
            return alibabaJson;
      }
B. The client will convert the json string to the corresponding javaBean
 First, the client should also import the two fastjson jar packages
1, the client to get the json string
public class HttpUtil
{
   
   public static String getJsonContent(String urlStr)
   {
      try