- All Known Implementing Classes:
GsonJson
public interface Json
JSON marshalling and unmarshalling service that is used by ODO both internally and can be used by client applications
-
Method Summary
Modifier and Type Method Description Stringmarshal(Object instance)Marshals an instance of an object to aString<T> Tunmarshal(String json, Class<T> target)Converts a json string into an instance of the given target typedefault Map<String,Object>unmarshalToMap(String json)convenience method to convert json to aMapinstance
-
Method Details
-
marshal
Marshals an instance of an object to aString- Parameters:
instance- to marshal to string, will throwNullPointerExceptionif the parameter is null- Returns:
- and instance of the instance parameter in a JSON string
-
unmarshal
Converts a json string into an instance of the given target type- Type Parameters:
T- the return type of the class- Parameters:
json- String of JSON to converttarget- type of the target to convert the json to- Returns:
- an instance of the converted json string
-
unmarshalToMap
convenience method to convert json to aMapinstance- Parameters:
json- the json to convert to a Map- Returns:
- the unmarshalled json in a Map
-