First, what exactly isJSON ?
JSON is a string of strings except that the elements are labeled with a particular symbol.
{} Double brackets represent objects
[] brackets represent the array
"" In double quotes is a property or value
: A colon indicates that the latter is a value (the value can be a string, a number, or another array or object)
So {"name": "Michael"} can be understood as an object containing the name Michael
And [{"Name": "Michael"},{"name": "Jerry"}] represents an array containing two objects
Of course, you can also use {"Name": ["Michael", "Jerry"]} to simplify the above, which is an object with a name array
Note: {"ABC"} is not in JSON format, the JSON format is in the form of a key-value pair.
to the Fastjson: the usual methods are as follows:
Public static final Object parse (String text); The
parse the JSON text as Jsonobject or Jsonarray.
public static final Jsonobject parseobject (String text);
Parse the JSON text into Jsonobject.
public static final <T> T parseobject (String text, class<t> clazz);
Parse the JSON text as JavaBean.
public static final Jsonarray Parsearray (String text);
Parse the JSON text into Jsonarray.
public static final <T> list<t> Parsearray (String text, class<t> clazz);
/parse the JSON text into a JavaBean collection.
public static final String tojsonstring (Object object);
Serializes the JavaBean into JSON text.
public static final String tojsonstring (Object object, Boolean prettyformat);
Serializes the JavaBean into formatted JSON text.
public static final object ToJSON (object javaobject);
Convert JavaBean to Jsonobject or Jsonarray.