src/main/java/de/alpharogroup/xml/json/ObjectToJsonExtensions.java
public static <T> String toJson(final T object, final boolean newMapper)
		throws JsonProcessingException
	{
		final ObjectMapper mapper = ObjectMapperFactory.getObjectMapper(newMapper);
		final String json = mapper.writeValueAsString(object);
		return json;
	}
public static <T> String toJson(final T object, final boolean newMapper)
		throws JsonProcessingException
	{
		final ObjectMapper mapper = ObjectMapperFactory.getObjectMapper(newMapper);
		final String json = mapper.writeValueAsString(object);
		return json;
	}
To json.

@param <T>
the generic type
@param object
the object
@param newMapper
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.
@return the string
@throws JsonProcessingException
If an error occurs when converting object to String