public interface JsonService
JSON
facade.Modifier and Type | Method and Description |
---|---|
<T> T |
fromJson(String json,
Class<T> pojo)
Convert the given JSON string to the given typed POJO.
|
<T> List<T> |
fromJsonList(String json,
Class<T> pojo)
Convert the given JSON string to a typed list of POJO's.
|
<T> String |
toJson(T pojo,
boolean prettyPrint)
Convert a POJO to its JSON representation.
|
<T> String |
toJsonList(Collection<T> pojos,
Class<T> pojo,
boolean prettyPrint)
Convert a collection of POJO's into its JSON representation.
|
<T> T fromJson(String json, Class<T> pojo)
json
- JSON string representing an instance of the given POJO
classpojo
- POJO class of the given JSON string<T> List<T> fromJsonList(String json, Class<T> pojo)
json
- JSON string representing a typed list of POJO'spojo
- POJO class of the given JSON string<T> String toJson(T pojo, boolean prettyPrint)
pojo
- POJO instance to convertprettyPrint
- human-readable formatted JSON if true, single-line
JSON otherwise<T> String toJsonList(Collection<T> pojos, Class<T> pojo, boolean prettyPrint)
pojos
- collection of POJO'spojo
- class of POJOprettyPrint
- human-readable formatted JSON if true, single-line
JSON otherwiseCopyright © 2015. All Rights Reserved.