Added ability to specify custom Gson to toJSON()