public static void writeUpload(JSONWriter writer, Attachment attachment) throws JSONException { JsonOutput.addIfNotNull(writer, "token", attachment.getToken()); JsonOutput.addIfNotNull(writer, "filename", attachment.getFileName()); JsonOutput.addIfNotNull(writer, "content_type", attachment.getContentType()); JsonOutput.addIfNotNull(writer, "description", attachment.getDescription()); }