fastJson common API to use

1, Fastjson API entry class is com.alibaba.fastjson.JSON, common sequence of operations can be static methods on a class JSON done directly.

public  static  Final Object parse (String text); // to parse text as JSON or JSONObject the JSONArray 
public  static  Final JSONObject the parseObject (String text); // the JSON parse text into JSONObject     
public  static  Final <T> T the parseObject (String text, class <T> clazz); // the JSON text to parse the JavaBean 
public  static  Final the JSONArray parseArray (String text); // the JSON parse text into the JSONArray 
public  static  Final <T> List <T> parseArray (text String, class < T> clazz); // the JSON parse text into a set of JavaBean 
public static  Final String the toJSONString (Object Object); // a JavaBean serialized as JSON text 
public  static  Final String the toJSONString (Object Object, Boolean PrettyFormat); // a JavaBean sequence as JSON formatted text 
public  static  Final Object a toJSON (Object javaObject); // convert to JSONObject JavaBean or JSONArray.

 

Reference: https://www.w3cschool.cn/fastjson/fastjson-ex2.html

Guess you like

Origin www.cnblogs.com/aibaiyang/p/11877484.html