Index: other-projects/the-macronizer/trunk/src/java/web/servlets/DirectInput.java
===================================================================
--- other-projects/the-macronizer/trunk/src/java/web/servlets/DirectInput.java	(revision 35720)
+++ other-projects/the-macronizer/trunk/src/java/web/servlets/DirectInput.java	(revision 35721)
@@ -139,5 +139,5 @@
             }
     
-            logger.info("Macron restoration succeeded. Input: " + fragment + " | Output: " + restoredFragment);
+            logger.debug("Macron restoration succeeded. Input: " + fragment + " | Output: " + restoredFragment);
         }
         catch (Exception ex)
Index: other-projects/the-macronizer/trunk/src/java/web/servlets/FileUpload.java
===================================================================
--- other-projects/the-macronizer/trunk/src/java/web/servlets/FileUpload.java	(revision 35720)
+++ other-projects/the-macronizer/trunk/src/java/web/servlets/FileUpload.java	(revision 35721)
@@ -13,4 +13,7 @@
 import javax.servlet.http.HttpServletResponse;
 
+import com.google.gson.Gson;
+import com.google.gson.stream.JsonWriter;
+
 import monogram.plugin.PluginConfiguration;
 import monogram.plugin.PluginManager;
@@ -25,7 +28,8 @@
 
 /**
+ * Represents a servlet for macronising the contents of a file.
  * @author University of Waikato - Te Whare WÄnanga o Waikato
- * @version 1.0
- * @since   2014-11-20 
+ * @version 2.0
+ * @since 2014-11-20 
  */
 public class FileUpload extends HttpServlet {
@@ -33,4 +37,6 @@
     // Create an instance of the logger object defined for the DirectInput servlet in log4j.properties.
     private static final Logger logger = Logger.getLogger(web.servlets.DirectInput.class.getName());
+
+    private final Gson gsonInstance = new Gson();
 
     private File tmpdir;
@@ -115,12 +121,34 @@
 
             restoredFile = pluginManager.run(configuration);
-            request.setAttribute("file", restoredFile);
-            request.setAttribute("fileType", configuration.getFileType());
-            request.setAttribute("charsetEncoding", "utf-8");
-            request.setAttribute("filename", properties.getFilename());
-            request.setAttribute("preserveMacrons", properties.getPreserveExistingMacrons());
-            request.setAttribute("options", properties.getShowAdvancedOptions());
-
-            forward(properties.getJspForwardPath() + "/main.jsp", request, response);
+
+            if (properties.getOutputType() == OutputType.Json)
+            {
+                response.setContentType("application/json; charset=UTF-8");
+                JsonWriter writer = gsonInstance.newJsonWriter(response.getWriter());
+                writer.beginObject();
+
+                writer.name("fileName");
+                writer.value(properties.getFileName());
+
+                writer.name("filePath");
+                writer.value(restoredFile.getPath());
+
+                writer.name("fileType");
+                writer.value(configuration.getFileType());
+                
+                writer.endObject();
+                writer.flush();
+            }
+            else
+            {
+                request.setAttribute("file", restoredFile);
+                request.setAttribute("fileType", configuration.getFileType());
+                request.setAttribute("charsetEncoding", "utf-8");
+                request.setAttribute("filename", properties.getFileName());
+                request.setAttribute("preserveMacrons", properties.getPreserveExistingMacrons());
+                request.setAttribute("options", properties.getShowAdvancedOptions());
+
+                forward(properties.getJspForwardPath() + "/main.jsp", request, response);
+            }
         }
         catch (UnsupportedOperationException uoex)
@@ -305,6 +333,16 @@
     {
         final File file = properties.getFile();
-        final String fileType = properties.getFileType().equals("(detect automatically)") ? FileUtil.guessFileType(file) : properties.getFileType();
-        final String charsetEncoding = properties.getCharsetEncoding().equals("(detect automatically)") ? "utf8" : properties.getCharsetEncoding();
+
+        String fileType = properties.getFileType();
+        if (fileType == null || fileType.equals("(detect automatically)"))
+        {
+            fileType = FileUtil.guessFileType(file);
+        }
+
+        String charsetEncoding = properties.getCharsetEncoding();
+        if (charsetEncoding == null || charsetEncoding.equals("(detect automatically)"))
+        {
+            charsetEncoding = "utf8";
+        }
 
         final PluginConfiguration configuration = new PluginConfiguration();
@@ -328,9 +366,13 @@
         private OutputType outputType;
 
+        public Properties() {
+            this.outputType = OutputType.JspRedirect;
+        }
+
         public File getFile() {
             return file;
         }
 
-        public String getFilename() {
+        public String getFileName() {
             return filename;
         }
