src/main/java/de/alpharogroup/xml/json/ObjectToJsonExtensions.java
public static <T> String toJson(final List<T> list)
		throws JsonGenerationException, JsonMappingException, IOException
	{
		final ByteArrayOutputStream out = new ByteArrayOutputStream();
		final ObjectMapper mapper = new ObjectMapper();

		mapper.writeValue(out, list);

		final byte[] bytes = out.toByteArray();
		out.close();
		return new String(bytes);
	}
public static <T> String toJson(final List<T> list)
		throws JsonGenerationException, JsonMappingException, IOException
	{
		final ByteArrayOutputStream out = new ByteArrayOutputStream();
		final ObjectMapper mapper = new ObjectMapper();

		mapper.writeValue(out, list);

		final byte[] bytes = out.toByteArray();
		out.close();
		return new String(bytes);
	}
Creates from the given {@link List} to a json string.

@param <T>
the generic type
@param list
the list
@return the json string.
@throws JsonGenerationException
If an error occurs by writing json string
@throws JsonMappingException
the If an error occurs when mapping the string into Object
@throws IOException
Signals that an I/O exception has occurred.