Here you can find the source of marshal(final Object object)
public static final synchronized String marshal(final Object object) throws JAXBException, IOException
//package com.java2s; //License from project: Open Source License import com.google.gson.Gson; import java.io.IOException; import javax.xml.bind.JAXBException; public class Main { public static final synchronized String marshal(final Object object) throws JAXBException, IOException { Gson gson = new Gson(); return gson.toJson(object); }//from ww w .j a v a 2s .c om }