Here you can find the source of serialize(final Object object)
public static final String serialize(final Object object) throws JAXBException, IOException
//package com.java2s; //License from project: Open Source License import com.fasterxml.jackson.databind.ObjectMapper; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.xml.bind.JAXBException; public class Main { public static final String serialize(final Object object) throws JAXBException, IOException { OutputStream outputStream = new ByteArrayOutputStream(); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(outputStream, object); return outputStream.toString(); }/*from w w w .j a va2 s . com*/ }