程序包 com.sh.json
类 JSONSerializer
java.lang.Object
com.sh.json.JSONSerializer
Transforms java objects into JSON and back.
Transformation from java to JSON is pretty straightforward, but the other way around needs certain configuration, otherwise the java objects produced will be DynaBeans and Lists, because the JSON notation does not carry any information on java classes.
Transformation from java to JSON is pretty straightforward, but the other way around needs certain configuration, otherwise the java objects produced will be DynaBeans and Lists, because the JSON notation does not carry any information on java classes.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static ObjectTransform a JSON value to a java object.
Depending on the configured values for conversion this will return a DynaBean, a bean, a List, or and array.static ObjecttoJava(JSON json, JsonConfig jsonConfig) Transform a JSON value to a java object.
Depending on the configured values for conversion this will return a DynaBean, a bean, a List, or and array.static JSONCreates a JSONObject, JSONArray or a JSONNull from object.
Accepts JSON formatted strings, Maps, arrays, Collections, DynaBeans and JavaBeans.static JSONtoJSON(Object object, JsonConfig jsonConfig) Creates a JSONObject, JSONArray or a JSONNull from object.
Accepts JSON formatted strings, Maps, arrays, Collections, DynaBeans and JavaBeans.
-
构造器详细资料
-
JSONSerializer
public JSONSerializer()
-
-
方法详细资料
-
toJava
Transform a JSON value to a java object.
Depending on the configured values for conversion this will return a DynaBean, a bean, a List, or and array.- 参数:
json- a JSON value- 返回:
- depends on the nature of the source object (JSONObject, JSONArray, JSONNull).
-
toJava
Transform a JSON value to a java object.
Depending on the configured values for conversion this will return a DynaBean, a bean, a List, or and array.- 参数:
json- a JSON valuejsonConfig- additional configuration- 返回:
- depends on the nature of the source object (JSONObject, JSONArray, JSONNull) and the configured rootClass, classMap and arrayMode
-
toJSON
Creates a JSONObject, JSONArray or a JSONNull from object.
Accepts JSON formatted strings, Maps, arrays, Collections, DynaBeans and JavaBeans.- 参数:
object- any java Object- 抛出:
JSONException- if the object can not be converted
-
toJSON
Creates a JSONObject, JSONArray or a JSONNull from object.
Accepts JSON formatted strings, Maps, arrays, Collections, DynaBeans and JavaBeans.- 参数:
object- any java ObjectjsonConfig- additional configuration- 抛出:
JSONException- if the object can not be converted
-