|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.json.JSONSerializer
public class 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.
Constructor Summary | |
---|---|
JSONSerializer()
|
Method Summary | |
---|---|
static Object |
toJava(JSON json)
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 Object |
toJava(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 JSON |
toJSON(Object object)
Creates a JSONObject, JSONArray or a JSONNull from object. Accepts JSON formatted strings, Maps, arrays, Collections, DynaBeans and JavaBeans. |
static JSON |
toJSON(Object object,
JsonConfig jsonConfig)
Creates a JSONObject, JSONArray or a JSONNull from object. Accepts JSON formatted strings, Maps, arrays, Collections, DynaBeans and JavaBeans. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSONSerializer()
Method Detail |
---|
public static Object toJava(JSON json)
json
- a JSON value
public static Object toJava(JSON json, JsonConfig jsonConfig)
json
- a JSON valuejsonConfig
- additional configuration
public static JSON toJSON(Object object)
object
- any java Object
JSONException
- if the object can not be convertedpublic static JSON toJSON(Object object, JsonConfig jsonConfig)
object
- any java ObjectjsonConfig
- additional configuration
JSONException
- if the object can not be converted
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |