Problem: If you want to convert an Java object to a String using Java.
Solution: You just only have to initialize ObjectMapper and use writeValueAsString(<objectName>).
Example:
// Initialize ObjectMapper
ObjectMapper om = new ObjectMapper();
// Convert object to String
om.writeValueAsString(objectName);
Source:
For more interesting tutorials & guides just check them HERE.