public class ObjectToJsonExtensions extends Object
ObjectToJsonExtensions converts java objects to json string objects.| Constructor and Description |
|---|
ObjectToJsonExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
toJson(List<T> list)
Creates from the given
List to a json string. |
static <T> String |
toJson(T object)
Creates from the given Object a json string.
|
static <T> String |
toJson(T object,
boolean newMapper)
To json.
|
public static <T> String toJson(List<T> list) throws com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException, IOException
List to a json string.T - the generic typelist - the listcom.fasterxml.jackson.core.JsonGenerationException - If an error occurs by writing json stringcom.fasterxml.jackson.databind.JsonMappingException - the If an error occurs when mapping the string into ObjectIOException - Signals that an I/O exception has occurred.public static <T> String toJson(T object) throws com.fasterxml.jackson.core.JsonProcessingException
T - the generic type of the given argumentobject - the object.com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to Stringpublic static <T> String toJson(T object, boolean newMapper) throws com.fasterxml.jackson.core.JsonProcessingException
T - the generic typeobject - the objectnewMapper - flag that indicates if a new ObjectMapper should be created. if true a new
ObjectMapper will be created otherwise the ObjectMapper from this class will be
returned.com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to StringCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.