# 12.1 Overview
JFinal's JSON module centers around the abstract class Json
, which is designed for easy extension with third-party implementations. JFinal officially provides three JSON implementations: JFinalJson
, FastJson
, and Jackson
. All three implementations extend the abstract class Json
.
The core abstraction of the Json
class is as follows:
public abstract class Json {
public abstract String toJson(Object object);
public abstract <T> T parse(String jsonString, Class <T> type);
}
1
2
3
4
2
3
4
As shown in the code above, the Json
abstraction consists of two methods for converting between Java objects and JSON strings. The toJson(...)
method converts any Java type to a JSON string, while the parse
method reverses a JSON string back into an object of a specified generic type.