/** * Serializes the specified object into its equivalent Json representation. * * @param src * the object for which Json representation is to be created. If * this is a String, it is wrapped in an instance of * {@link org.eclipse.jgit.lfs.server.internal.LfsGson.Error}. * @param writer * Writer to which the Json representation needs to be written * @throws com.google.gson.JsonIOException * if there was a problem writing to the writer * @see Gson#toJson(Object, Appendable) */ public static void toJson(Object src, Appendable writer) throws JsonIOException { if (src instanceof String) { gson.toJson(new Error((String) src), writer); } else { gson.toJson(src, writer); } }