diff --git a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
index a6379ec..7a4e40b 100644
--- a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
@@ -41,405 +41,405 @@
     private FieldType keywords  = new FieldType(TextField.TYPE_STORED);
 
     {
-	tvField.setStoreTermVectors(true);
-	tvField.setStoreTermVectorPositions(true);
-	tvField.setStoreTermVectorPayloads(true);
-	tvField.setStoreTermVectorOffsets(false);
+        tvField.setStoreTermVectors(true);
+        tvField.setStoreTermVectorPositions(true);
+        tvField.setStoreTermVectorPayloads(true);
+        tvField.setStoreTermVectorOffsets(false);
 
-	tvNoField.setStoreTermVectors(true);
-	tvNoField.setStoreTermVectorPositions(true);
-	tvNoField.setStoreTermVectorPayloads(true);
-	tvNoField.setStoreTermVectorOffsets(false);
+        tvNoField.setStoreTermVectors(true);
+        tvNoField.setStoreTermVectorPositions(true);
+        tvNoField.setStoreTermVectorPayloads(true);
+        tvNoField.setStoreTermVectorOffsets(false);
 
-	keywords.setStoreTermVectors(true);
-	keywords.setStoreTermVectorPositions(false);
-	keywords.setStoreTermVectorPayloads(false);
-	keywords.setStoreTermVectorOffsets(false);
-	keywords.setIndexOptions(IndexOptions.DOCS_ONLY);
-    }
+        keywords.setStoreTermVectors(true);
+        keywords.setStoreTermVectorPositions(false);
+        keywords.setStoreTermVectorPayloads(false);
+        keywords.setStoreTermVectorOffsets(false);
+        keywords.setIndexOptions(IndexOptions.DOCS_ONLY);
+    };
 
     // see http://www.cowtowncoder.com/blog/archives/2011/07/entry_457.html
 
     public void addInt (String key, int value) {
-	doc.add(new IntField(key, value, Field.Store.YES));
+        doc.add(new IntField(key, value, Field.Store.YES));
     };
 
     public void addInt (String key, String value) {
-	this.addInt(key, Integer.parseInt(value));
+        this.addInt(key, Integer.parseInt(value));
     };
 
     public void addText (String key, String value) {
-	doc.add(new TextField(key, value, Field.Store.YES));
+        doc.add(new TextField(key, value, Field.Store.YES));
     };
 
     public void addKeyword (String key, String value) {
-	doc.add(new Field(key, value, keywords));
+        doc.add(new Field(key, value, keywords));
     };
 
     public void addString (String key, String value) {
-	doc.add(new StringField(key, value, Field.Store.YES));
+        doc.add(new StringField(key, value, Field.Store.YES));
     };
 
     public void addStored (String key, String value) {
-	doc.add(new StoredField(key, value));
+        doc.add(new StoredField(key, value));
     };
 
     public void addStored (String key, int value) {
-	doc.add(new StoredField(key, value));
+        doc.add(new StoredField(key, value));
     };
 
     public void addTV (String key, String value, String tsString) {
-	this.addTV(key, value, new MultiTermTokenStream(tsString));
+        this.addTV(key, value, new MultiTermTokenStream(tsString));
     };
 
     public void addTV (String key, String tsString) {
-	this.addTV(key, new MultiTermTokenStream(tsString));
+        this.addTV(key, new MultiTermTokenStream(tsString));
     };
 
     public void addTV (String key, String value, MultiTermTokenStream ts) {
-	Field textField = new Field( key, value, tvField );
-	textField.setTokenStream( ts );
-	doc.add(textField);
+        Field textField = new Field( key, value, tvField );
+        textField.setTokenStream( ts );
+        doc.add(textField);
     };
 
     public void addTV (String key, MultiTermTokenStream ts) {
-	Field textField = new Field( key, ts, tvNoField );
-	doc.add(textField);
+        Field textField = new Field( key, ts, tvNoField );
+        doc.add(textField);
     };
 
     public String toString () {
-	return doc.toString();
+        return doc.toString();
     };
 
     public MultiTermTokenStream newMultiTermTokenStream (String ts) {
-	return new MultiTermTokenStream(ts);
+        return new MultiTermTokenStream(ts);
     };
 
     public MultiTermTokenStream newMultiTermTokenStream () {
-	return new MultiTermTokenStream();
+        return new MultiTermTokenStream();
     };
 
     /**
      * Deserialize token stream data.
      */
     public void setData (Map<String,Object> node) {
-	this.setPrimaryData((String) node.get("text"));
+        this.setPrimaryData((String) node.get("text"));
 
-	String fieldName = (String) node.get("name");
-	MultiTermTokenStream mtts = this.newMultiTermTokenStream();
+        String fieldName = (String) node.get("name");
+        MultiTermTokenStream mtts = this.newMultiTermTokenStream();
 
-	// Iterate over all tokens in stream
-	for (ArrayList<String> token : (ArrayList<ArrayList<String>>) node.get("stream")) {
+        // Iterate over all tokens in stream
+        for (ArrayList<String> token : (ArrayList<ArrayList<String>>) node.get("stream")) {
 
-	    // Initialize MultiTermToken
-	    MultiTermToken mtt = new MultiTermToken(token.remove(0));
+            // Initialize MultiTermToken
+            MultiTermToken mtt = new MultiTermToken(token.remove(0));
 
-	    // Add rest of the list
-	    for (String term : token)
-		mtt.add(term);
+            // Add rest of the list
+            for (String term : token)
+                mtt.add(term);
 
-	    // Add MultiTermToken to stream
-	    mtts.addMultiTermToken(mtt);
-	};
+            // Add MultiTermToken to stream
+            mtts.addMultiTermToken(mtt);
+        };
 
-	// Add tokenstream to fielddocument
-	this.addTV(fieldName, this.getPrimaryData(), mtts);
+        // Add tokenstream to fielddocument
+        this.addTV(fieldName, this.getPrimaryData(), mtts);
 
-	// Get foundry info
-	if (node.containsKey("foundries"))
-	    this.setFoundries((String) node.get("foundries"));
+        // Get foundry info
+        if (node.containsKey("foundries"))
+            this.setFoundries((String) node.get("foundries"));
 
-	// Get layer info
-	if (node.containsKey("layerInfos"))
-	    this.setLayerInfos((String) node.get("layerInfos"));
+        // Get layer info
+        if (node.containsKey("layerInfos"))
+            this.setLayerInfos((String) node.get("layerInfos"));
 
-	// Get tokenSource info
-	if (node.containsKey("tokenSource"))
-	    this.setTokenSource((String) node.get("tokenSource"));
+        // Get tokenSource info
+        if (node.containsKey("tokenSource"))
+            this.setTokenSource((String) node.get("tokenSource"));
     };
 
     /**
      * Deserialize token stream data (LEGACY).
      */
     public void setFields (ArrayList<Map<String,Object>> fields) {
+        
+        Map<String,Object> primary = fields.remove(0);
+        this.setPrimaryData((String) primary.get("primaryData"));
 
-	Map<String,Object> primary = fields.remove(0);
-	this.setPrimaryData((String) primary.get("primaryData"));
+        for (Map<String,Object> field : fields) {
 
-	for (Map<String,Object> field : fields) {
+            String fieldName = (String) field.get("name");
+            MultiTermTokenStream mtts = this.newMultiTermTokenStream();
 
-	    String fieldName = (String) field.get("name");
-	    MultiTermTokenStream mtts = this.newMultiTermTokenStream();
+            for (ArrayList<String> token : (ArrayList<ArrayList<String>>) field.get("data")) {
 
-	    for (ArrayList<String> token : (ArrayList<ArrayList<String>>) field.get("data")) {
+                MultiTermToken mtt = new MultiTermToken(token.remove(0));
 
-		MultiTermToken mtt = new MultiTermToken(token.remove(0));
+                for (String term : token) {
+                    mtt.add(term);
+                };
 
-		for (String term : token) {
-		    mtt.add(term);
-		};
+                mtts.addMultiTermToken(mtt);
+            };
 
-		mtts.addMultiTermToken(mtt);
-	    };
+            // TODO: This is normally dependend to the tokenization!
+            //       Add this as meta information to the document
+            // Store this information as well as tokenization information
+            // as meta fields in the tokenization term vector
+            if (field.containsKey("foundries")) {
+                // TODO: Do not store positions!
+                String foundries = (String) field.get("foundries");
+                this.addKeyword("foundries", foundries);
+                super.setFoundries(foundries);
+            };
+            if (field.containsKey("tokenization")) {
+                String tokenization = (String) field.get("tokenization");
+                this.addString("tokenization", tokenization);
+                super.setTokenization(tokenization);
+            };
 
-	    // TODO: This is normally dependend to the tokenization!
-	    //       Add this as meta information to the document
-	    // Store this information as well as tokenization information
-	    // as meta fields in the tokenization term vector
-	    if (field.containsKey("foundries")) {
-		// TODO: Do not store positions!
-		String foundries = (String) field.get("foundries");
-		this.addKeyword("foundries", foundries);
-		super.setFoundries(foundries);
-	    };
-	    if (field.containsKey("tokenization")) {
-		String tokenization = (String) field.get("tokenization");
-		this.addString("tokenization", tokenization);
-		super.setTokenization(tokenization);
-	    };
-
-	    this.addTV(fieldName, this.getPrimaryData(), mtts);
-	};
+            this.addTV(fieldName, this.getPrimaryData(), mtts);
+        };
     };
 
     @Override
     public void setTextClass (String textClass) {
-	super.setTextClass(textClass);
-	this.addKeyword("textClass", textClass);
+        super.setTextClass(textClass);
+        this.addKeyword("textClass", textClass);
     };
 
     @Override
     public void setTitle (String title) {
-	super.setTitle(title);
-	this.addText("title", title);
+        super.setTitle(title);
+        this.addText("title", title);
     };
 
     @Override
     public void setSubTitle (String subTitle) {
-	super.setSubTitle(subTitle);
-	this.addText("subTitle", subTitle);
+        super.setSubTitle(subTitle);
+        this.addText("subTitle", subTitle);
     };
 
     @Override
     public void setAuthor (String author) {
-	super.setAuthor(author);
-	this.addText("author", author);
+        super.setAuthor(author);
+        this.addText("author", author);
     };
 
     @Override
     public void setPubPlace (String pubPlace) {
-	super.setPubPlace(pubPlace);
-	this.addString("pubPlace", pubPlace);
+        super.setPubPlace(pubPlace);
+        this.addString("pubPlace", pubPlace);
     };
 
     @JsonProperty("pubDate")
     @Override
     public KorapDate setPubDate (String pubDate) {
-	KorapDate date = super.setPubDate(pubDate);
-	this.addInt("pubDate", date.toString());
-	return date;
+        KorapDate date = super.setPubDate(pubDate);
+        this.addInt("pubDate", date.toString());
+        return date;
     };
 
     @JsonProperty("creationDate")
     @Override
     public KorapDate setCreationDate (String creationDate) {
-	KorapDate date = super.setCreationDate(creationDate);
-	this.addInt("creationDate", date.toString());
-	return date;
+        KorapDate date = super.setCreationDate(creationDate);
+        this.addInt("creationDate", date.toString());
+        return date;
     };
 
     // No longer supported
     @Override
     public void setCorpusID (String corpusID) {
-	super.setCorpusID(corpusID);
-	this.addString("corpusID", corpusID);
+        super.setCorpusID(corpusID);
+        this.addString("corpusID", corpusID);
     };
 
     // No longer supported
     @Override
     public void setID (String ID) {
-	super.setID(ID);
-	this.addString("ID", ID);
+        super.setID(ID);
+        this.addString("ID", ID);
     };
 
     @Override
     public void setUID (int ID) {
-	super.setUID(ID);
-	this.addString("UID", new Integer(ID).toString());
+        super.setUID(ID);
+        this.addString("UID", new Integer(ID).toString());
     };
 
     // No longer supported
     @Override
     public void setLayerInfo (String layerInfo) {
-	super.setLayerInfo(layerInfo);
-	this.addStored("layerInfo", layerInfo);
+        super.setLayerInfo(layerInfo);
+        this.addStored("layerInfo", layerInfo);
     };
 
     @Override
     public void setLayerInfos (String layerInfos) {
-	super.setLayerInfos(layerInfos);
-	this.addStored("layerInfos", layerInfos);
+        super.setLayerInfos(layerInfos);
+        this.addStored("layerInfos", layerInfos);
     };
 
     @Override
     public void setTextSigle (String textSigle) {
-	super.setTextSigle(textSigle);
-	this.addString("textSigle", textSigle);
+        super.setTextSigle(textSigle);
+        this.addString("textSigle", textSigle);
     };
 
     @Override
     public void setDocSigle (String docSigle) {
-	super.setDocSigle(docSigle);
-	this.addString("docSigle", docSigle);
+        super.setDocSigle(docSigle);
+        this.addString("docSigle", docSigle);
     };
 
     @Override
     public void setCorpusSigle (String corpusSigle) {
-	super.setCorpusSigle(corpusSigle);
-	this.addString("corpusSigle", corpusSigle);
+        super.setCorpusSigle(corpusSigle);
+        this.addString("corpusSigle", corpusSigle);
     };
 
     @Override
     public void setPublisher (String publisher) {
-	super.setPublisher(publisher);
-	this.addStored("publisher", publisher);
+        super.setPublisher(publisher);
+        this.addStored("publisher", publisher);
     };
 
     @Override
     public void setEditor (String editor) {
-	super.setEditor(editor);
-	this.addStored("editor", editor);
+        super.setEditor(editor);
+        this.addStored("editor", editor);
     };
 
     @Override
     public void setTextType (String textType) {
-	super.setTextType(textType);
-	this.addString("textType", textType);
+        super.setTextType(textType);
+        this.addString("textType", textType);
     };
 
     @Override
     public void setTextTypeArt (String textTypeArt) {
-	super.setTextTypeArt(textTypeArt);
-	this.addString("textTypeArt", textTypeArt);
+        super.setTextTypeArt(textTypeArt);
+        this.addString("textTypeArt", textTypeArt);
     };
 
     @Override
     public void setTextTypeRef (String textTypeRef) {
-	super.setTextTypeRef(textTypeRef);
-	this.addString("textTypeRef", textTypeRef);
+        super.setTextTypeRef(textTypeRef);
+        this.addString("textTypeRef", textTypeRef);
     };
 
     @Override
     public void setTextColumn (String textColumn) {
-	super.setTextColumn(textColumn);
-	this.addString("textColumn", textColumn);
+        super.setTextColumn(textColumn);
+        this.addString("textColumn", textColumn);
     };
 
     @Override
     public void setTextDomain (String textDomain) {
-	super.setTextDomain(textDomain);
-	this.addString("textDomain", textDomain);
+        super.setTextDomain(textDomain);
+        this.addString("textDomain", textDomain);
     };
 
     @Override
     public void setLicense (String license) {
-	super.setLicense(license);
-	this.addString("license", license);
+        super.setLicense(license);
+        this.addString("license", license);
     };
 
     @Override
     public void setPages (String pages) {
-	super.setPages(pages);
-	this.addStored("pages", pages);
+        super.setPages(pages);
+        this.addStored("pages", pages);
     };
 
     @Override
     public void setFileEditionStatement (String fileEditionStatement) {
-	super.setFileEditionStatement(fileEditionStatement);
-	this.addStored("fileEditionStatement", fileEditionStatement);
+        super.setFileEditionStatement(fileEditionStatement);
+        this.addStored("fileEditionStatement", fileEditionStatement);
     };
 
     @Override
     public void setBiblEditionStatement (String biblEditionStatement) {
-	super.setBiblEditionStatement(biblEditionStatement);
-	this.addStored("biblEditionStatement", biblEditionStatement);
+        super.setBiblEditionStatement(biblEditionStatement);
+        this.addStored("biblEditionStatement", biblEditionStatement);
     };
 
     @Override
     public void setReference (String reference) {
-	super.setReference(reference);
-	this.addStored("reference", reference);
+        super.setReference(reference);
+        this.addStored("reference", reference);
     };
 
     @Override
     public void setLanguage (String language) {
-	super.setLanguage(language);
-	this.addString("language", language);
+        super.setLanguage(language);
+        this.addString("language", language);
     };
 
     @Override
     public void setDocTitle (String docTitle) {
-	super.setDocTitle(docTitle);
-	this.addText("docTitle", docTitle);
+        super.setDocTitle(docTitle);
+        this.addText("docTitle", docTitle);
     };
 
     @Override
     public void setDocSubTitle (String docSubTitle) {
-	super.setDocSubTitle(docSubTitle);
-	this.addText("docSubTitle", docSubTitle);
+        super.setDocSubTitle(docSubTitle);
+        this.addText("docSubTitle", docSubTitle);
     };
 
     @Override
     public void setDocAuthor (String docAuthor) {
-	super.setDocAuthor(docAuthor);
-	this.addText("docAuthor", docAuthor);
+        super.setDocAuthor(docAuthor);
+        this.addText("docAuthor", docAuthor);
     };
 
     @Override
     public void setDocEditor (String docEditor) {
-	super.setDocEditor(docEditor);
-	this.addStored("docEditor", docEditor);
+        super.setDocEditor(docEditor);
+        this.addStored("docEditor", docEditor);
     };
 
     @Override
     public void setCorpusTitle (String corpusTitle) {
-	super.setCorpusTitle(corpusTitle);
-	this.addText("corpusTitle", corpusTitle);
+        super.setCorpusTitle(corpusTitle);
+        this.addText("corpusTitle", corpusTitle);
     };
 
     @Override
     public void setCorpusSubTitle (String corpusSubTitle) {
-	super.setCorpusSubTitle(corpusSubTitle);
-	this.addText("corpusSubTitle", corpusSubTitle);
+        super.setCorpusSubTitle(corpusSubTitle);
+        this.addText("corpusSubTitle", corpusSubTitle);
     };
 
     @Override
     public void setCorpusAuthor (String corpusAuthor) {
-	super.setCorpusAuthor(corpusAuthor);
-	this.addText("corpusAuthor", corpusAuthor);
+        super.setCorpusAuthor(corpusAuthor);
+        this.addText("corpusAuthor", corpusAuthor);
     };
 
     @Override
     public void setCorpusEditor (String corpusEditor) {
-	super.setCorpusEditor(corpusEditor);
-	this.addStored("corpusEditor", corpusEditor);
+        super.setCorpusEditor(corpusEditor);
+        this.addStored("corpusEditor", corpusEditor);
     };
 
     @Override
     public void setKeywords (String keywords) {
-	super.setKeywords(keywords);
-	this.addKeyword("keywords", keywords);
+        super.setKeywords(keywords);
+        this.addKeyword("keywords", keywords);
     };
 
     @Override
     public void setTokenSource (String tokenSource) {
-	super.setTokenSource(tokenSource);
-	this.addStored("tokenSource", tokenSource);
+        super.setTokenSource(tokenSource);
+        this.addStored("tokenSource", tokenSource);
     };
 
     @Override
     public void setFoundries (String foundries) {
-	super.setFoundries(foundries);
-	this.addKeyword("foundries", foundries);
+        super.setFoundries(foundries);
+        this.addKeyword("foundries", foundries);
     };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/response/KorapResponse.java b/src/main/java/de/ids_mannheim/korap/response/KorapResponse.java
index 46d4028..c826f71 100644
--- a/src/main/java/de/ids_mannheim/korap/response/KorapResponse.java
+++ b/src/main/java/de/ids_mannheim/korap/response/KorapResponse.java
@@ -7,7 +7,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
 import de.ids_mannheim.korap.response.Notifications;
+import de.ids_mannheim.korap.response.serialize.KorapResponseDeserializer;
 
 /**
  * Base class for objects meant to be responded by the server.
@@ -23,6 +26,7 @@
  * @author Nils Diewald
  * @see de.ids_mannheim.korap.response.Notifications
  */
+@JsonDeserialize(using = KorapResponseDeserializer.class)
 public class KorapResponse extends Notifications {
     ObjectMapper mapper = new ObjectMapper();
 
@@ -30,7 +34,6 @@
     private String benchmark;
     private boolean timeExceeded = false;
 
-
     /**
      * Construct a new KorapResponse object.
      *
@@ -47,8 +50,8 @@
      */
     @JsonIgnore
     public KorapResponse setVersion (String version) {
-	this.version = version;
-	return this;
+        this.version = version;
+        return this;
     };
 
 
@@ -59,7 +62,7 @@
      */
     @JsonIgnore
     public String getVersion () {
-	return this.version;
+        return this.version;
     };
 
 
@@ -72,8 +75,8 @@
      */
     @JsonIgnore
     public KorapResponse setName (String name) {
-	this.name = name;
-	return this;
+        this.name = name;
+        return this;
     };
 
 
@@ -85,7 +88,7 @@
      */
     @JsonIgnore
     public String getName () {
-	return this.name;
+        return this.name;
     };
 
 
@@ -98,8 +101,8 @@
      */
     @JsonIgnore
     public KorapResponse setNode (String name) {
-	this.node = name;
-	return this;
+        this.node = name;
+        return this;
     };
 
 
@@ -111,9 +114,9 @@
      */
     @JsonIgnore
     public String getNode () {
-	return this.node;
+        return this.node;
     };
-
+    
 
     /**
      * Set to <tt>true</tt> if time is exceeded
@@ -128,10 +131,10 @@
      */
     @JsonIgnore
     public KorapResponse setTimeExceeded (boolean timeout) {
-	if (timeout)
-	    this.addWarning(682, "Response time exceeded");
-	this.timeExceeded = timeout;
-	return this;
+        if (timeout)
+            this.addWarning(682, "Response time exceeded");
+        this.timeExceeded = timeout;
+        return this;
     };
 
 
@@ -142,8 +145,8 @@
      *         otherwise <tt>false</tt>
      */
     @JsonIgnore
-    public boolean getTimeExceeded () {
-	return this.timeExceeded;
+    public boolean hasTimeExceeded () {
+        return this.timeExceeded;
     };
 
 
@@ -157,14 +160,14 @@
     @JsonIgnore
     public KorapResponse setBenchmark (long ts1, long ts2) {
         this.benchmark =
-	    (ts2 - ts1) < 100_000_000 ?
-	    // Store as miliseconds
-	    (((double) (ts2 - ts1) * 1e-6) + " ms") :
-	    // Store as seconds
-	    (((double) (ts2 - ts1) / 1000000000.0) + " s");
-	return this;
+            (ts2 - ts1) < 100_000_000 ?
+            // Store as miliseconds
+            (((double) (ts2 - ts1) * 1e-6) + " ms") :
+            // Store as seconds
+            (((double) (ts2 - ts1) / 1000000000.0) + " s");
+        return this;
     };
-
+    
 
     /**
      * Set the benchmark as a string representation.
@@ -175,8 +178,8 @@
      */
     @JsonIgnore
     public KorapResponse setBenchmark (String bm) {
-	this.benchmark = bm;
-	return this;
+        this.benchmark = bm;
+        return this;
     };
 
 
@@ -190,7 +193,7 @@
     public String getBenchmark () {
         return this.benchmark;
     };
-
+    
 
     /**
      * Set the listener URI as a String. This is probably the localhost
@@ -206,10 +209,10 @@
      */
     @JsonIgnore
     public KorapResponse setListener (String listener) {
-	this.listener = listener;
-	return this;
+        this.listener = listener;
+        return this;
     };
-
+    
 
     /**
      * Get the listener URI as a string.
@@ -218,7 +221,7 @@
      */
     @JsonIgnore
     public String getListener () {
-	return this.listener;
+        return this.listener;
     };
 
 
@@ -230,27 +233,27 @@
     @Override
     public JsonNode toJsonNode () {
 
-	// Get notifications json response
-	ObjectNode json = (ObjectNode) super.toJsonNode();
+        // Get notifications json response
+        ObjectNode json = (ObjectNode) super.toJsonNode();
 
-	StringBuilder sb = new StringBuilder();
+        StringBuilder sb = new StringBuilder();
         if (this.getName() != null) {
-	    sb.append(this.getName());
+            sb.append(this.getName());
+            
+            if (this.getVersion() != null)
+                sb.append("-");
+        };
 
-	    if (this.getVersion() != null)
-		sb.append("-");
-	};
+        // No name but version is given
+        if (this.getVersion() != null)
+            sb.append(this.getVersion());
 
-	// No name but version is given
-	if (this.getVersion() != null)
-	    sb.append(this.getVersion());
-
-	if (sb.length() > 0)
-	    json.put("version", sb.toString());
-
-	if (this.timeExceeded)
-	    json.put("timeExceeded", true);
-
+        if (sb.length() > 0)
+            json.put("version", sb.toString());
+        
+        if (this.timeExceeded)
+            json.put("timeExceeded", true);
+        
         if (this.getNode() != null)
             json.put("node", this.getNode());
 
@@ -260,7 +263,7 @@
         if (this.getBenchmark() != null)
             json.put("benchmark", this.getBenchmark());
 
-	return (JsonNode) json;
+        return (JsonNode) json;
     };
 
     /**
@@ -286,19 +289,19 @@
      * @return String representation of the response
      */
     public String toJsonString () {
-	String msg = "";
-	try {
-	    return mapper.writeValueAsString(this.toJsonNode());
-	}
-	catch (Exception e) {
-	    // Bad in case the message contains quotes!
-	    msg = ", \"" + e.getLocalizedMessage() + "\"";
-	};
+        String msg = "";
+        try {
+            return mapper.writeValueAsString(this.toJsonNode());
+        }
+        catch (Exception e) {
+            // Bad in case the message contains quotes!
+            msg = ", \"" + e.getLocalizedMessage() + "\"";
+        };
 
-	return
-	    "{\"errors\":["+
-	    "[620, " +
-	    "\"Unable to generate JSON\"" + msg + "]" +
-	    "]}";
+        return
+            "{\"errors\":["+
+            "[620, " +
+            "\"Unable to generate JSON\"" + msg + "]" +
+            "]}";
     };
 };
diff --git a/src/main/java/de/ids_mannheim/korap/response/serialize/KorapResponseDeserializer.java b/src/main/java/de/ids_mannheim/korap/response/serialize/KorapResponseDeserializer.java
new file mode 100644
index 0000000..3e009bd
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/response/serialize/KorapResponseDeserializer.java
@@ -0,0 +1,60 @@
+package de.ids_mannheim.korap.response.serialize;
+
+import java.util.*;
+import java.io.*;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+
+import de.ids_mannheim.korap.response.KorapResponse;
+
+public class KorapResponseDeserializer extends JsonDeserializer<KorapResponse> {
+ 
+    @Override
+    public KorapResponse deserialize (JsonParser parser, DeserializationContext ctxt)
+        throws IOException, JsonProcessingException {
+        JsonNode node = parser.getCodec().readTree(parser);
+        KorapResponse kresp = new KorapResponse();
+
+        // Deserialize version information
+        if (node.has("version")) {
+            String fullVersion = node.get("version").asText();
+            int found = fullVersion.lastIndexOf('-');
+
+            // Is combined name and version
+            if (found > 0 && (found + 1 < fullVersion.length())) {
+                kresp.setName(fullVersion.substring(0, found))
+                     .setVersion(fullVersion.substring(found + 1));
+            }
+            // Is only version number
+            else {
+                kresp.setVersion(fullVersion);
+            };
+        };
+
+        // Deserialize timeout information
+        if (node.has("timeExceeded") && node.get("timeExceeded").asBoolean()) {
+            kresp.setTimeExceeded(true);
+        };
+
+        // Deserialize benchmark information
+        if (node.has("benchmark"))
+            kresp.setBenchmark(node.get("benchmark").asText());
+
+        // Deserialize listener information
+        if (node.has("listener"))
+            kresp.setListener(node.get("listener").asText());
+
+        // Deserialize listener information
+        if (node.has("node"))
+            kresp.setNode(node.get("node").asText());
+
+        // Copy notifications
+        kresp.copyNotificationsFrom(node);
+
+        return kresp;
+    };
+};
diff --git a/src/test/java/de/ids_mannheim/korap/response/TestResponse.java b/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
index b2116cb..43686f0 100644
--- a/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
+++ b/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
@@ -22,63 +22,127 @@
 
     @Test
     public void testResponse () throws IOException {
-	KorapResponse resp = new KorapResponse();
-	assertEquals("{}", resp.toJsonString());
-	resp.setVersion("0.24");
-	resp.setNode("Tanja");
-	assertEquals("0.24",resp.getVersion());
-	assertEquals("Tanja", resp.getNode());
+		KorapResponse resp = new KorapResponse();
+		assertEquals("{}", resp.toJsonString());
+		resp.setVersion("0.24");
+        resp.setNode("Tanja");
+        assertEquals("0.24",resp.getVersion());
+        assertEquals("Tanja", resp.getNode());
 
-	assertFalse(resp.hasWarnings());
-	assertFalse(resp.hasMessages());
-	assertFalse(resp.hasErrors());
+        assertFalse(resp.hasWarnings());
+        assertFalse(resp.hasMessages());
+        assertFalse(resp.hasErrors());
 
-	JsonNode respJson = mapper.readTree(resp.toJsonString());
-	assertEquals("0.24", respJson.at("/version").asText());
-	assertEquals("Tanja", respJson.at("/node").asText());
+        JsonNode respJson = mapper.readTree(resp.toJsonString());
+        assertEquals("0.24", respJson.at("/version").asText());
+        assertEquals("Tanja", respJson.at("/node").asText());
 
-	resp.setName("Index");
-	respJson = mapper.readTree(resp.toJsonString());
-	assertEquals("Index-0.24", respJson.at("/version").asText());
-	assertEquals("Tanja", respJson.at("/node").asText());
+        resp.setName("Index");
+        respJson = mapper.readTree(resp.toJsonString());
+        assertEquals("Index-0.24", respJson.at("/version").asText());
+        assertEquals("Tanja", respJson.at("/node").asText());
 
-	resp.setBenchmark("took a while");
-	resp.setListener("localhost:3000");
-	respJson = mapper.readTree(resp.toJsonString());
-	assertEquals("localhost:3000", respJson.at("/listener").asText());
-	assertEquals("took a while", respJson.at("/benchmark").asText());
+        resp.setBenchmark("took a while");
+        resp.setListener("localhost:3000");
+        respJson = mapper.readTree(resp.toJsonString());
+        assertEquals("localhost:3000", respJson.at("/listener").asText());
+        assertEquals("took a while", respJson.at("/benchmark").asText());
     };
 
     @Test
     public void testResponseNotifications () throws IOException {
-	KorapResponse resp = new KorapResponse();
-	assertEquals("{}", resp.toJsonString());
-	resp.setVersion("0.24");
-	resp.setNode("Tanja");
-	assertEquals("0.24",resp.getVersion());
-	assertEquals("Tanja", resp.getNode());
+        KorapResponse resp = new KorapResponse();
+        assertEquals("{}", resp.toJsonString());
+        resp.setVersion("0.24");
+        resp.setNode("Tanja");
+        assertEquals("0.24",resp.getVersion());
+        assertEquals("Tanja", resp.getNode());
 
-	assertFalse(resp.hasWarnings());
-	assertFalse(resp.hasMessages());
-	assertFalse(resp.hasErrors());
+        assertFalse(resp.hasWarnings());
+        assertFalse(resp.hasMessages());
+        assertFalse(resp.hasErrors());
 
-	JsonNode respJson = mapper.readTree(resp.toJsonString());
-	assertEquals("0.24", respJson.at("/version").asText());
-	assertEquals("Tanja", respJson.at("/node").asText());
+        JsonNode respJson = mapper.readTree(resp.toJsonString());
+        assertEquals("0.24", respJson.at("/version").asText());
+        assertEquals("Tanja", respJson.at("/node").asText());
 
-	resp.addWarning(1, "Fehler 1");
-	resp.addWarning(2, "Fehler 2");
-	resp.addWarning(3, "Fehler 3");
+        resp.addWarning(1, "Fehler 1");
+        resp.addWarning(2, "Fehler 2");
+        resp.addWarning(3, "Fehler 3");
 
-	resp.addError(4, "Fehler 4");
+        resp.addError(4, "Fehler 4");
 
-	respJson = mapper.readTree(resp.toJsonString());
-	assertEquals("0.24", respJson.at("/version").asText());
-	assertEquals("Tanja", respJson.at("/node").asText());
+        respJson = mapper.readTree(resp.toJsonString());
+        assertEquals("0.24", respJson.at("/version").asText());
+        assertEquals("Tanja", respJson.at("/node").asText());
+        
+        assertEquals("Fehler 1", respJson.at("/warnings/0/1").asText());
+        assertEquals("Fehler 2", respJson.at("/warnings/1/1").asText());
+        assertEquals("Fehler 3", respJson.at("/warnings/2/1").asText());
+        assertEquals("Fehler 4", respJson.at("/errors/0/1").asText());
+    };
 
-	assertEquals("Fehler 1", respJson.at("/warnings/0/1").asText());
-	assertEquals("Fehler 2", respJson.at("/warnings/1/1").asText());
-	assertEquals("Fehler 3", respJson.at("/warnings/2/1").asText());
-	assertEquals("Fehler 4", respJson.at("/errors/0/1").asText());
+    @Test
+    public void testResponseDeserialzation () throws IOException {
+        String jsonResponse = "{\"version\":\"0.38\"}";
+        KorapResponse kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("0.38", kresp.getVersion());
+        assertNull(kresp.getName());
+        assertEquals(jsonResponse, kresp.toJsonString());
+
+        jsonResponse = "{\"version\":\"seaweed-0.49\"}";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("0.49", kresp.getVersion());
+        assertEquals("seaweed", kresp.getName());
+        assertTrue(kresp.toJsonString().contains("seaweed-0.49"));
+
+        jsonResponse = "{\"version\":\"seaweed-\"}";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("seaweed-", kresp.getVersion());
+        assertNull(kresp.getName());
+        assertTrue(kresp.toJsonString().contains("seaweed-"));
+
+        jsonResponse = "{\"timeExceeded\":true}";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertTrue(kresp.hasTimeExceeded());
+        assertTrue(kresp.hasWarnings());
+
+        jsonResponse = "{\"benchmark\":\"40.5s\", \"foo\":\"bar\"}";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("40.5s", kresp.getBenchmark());
+
+        jsonResponse = "{\"listener\":\"10.0.10.14:678\", \"foo\":\"bar\"}";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("10.0.10.14:678", kresp.getListener());
+
+        jsonResponse = "{\"node\":\"tanja\", \"foo\":\"bar\"}";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("tanja", kresp.getNode());
+
+        jsonResponse = "{\"node\":\"tanja\", \"version\":\"seaweed-0.49\", " +
+            " \"benchmark\":\"40.5s\",  \"listener\":\"10.0.10.14:678\"," +
+            "\"timeExceeded\":true }";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+        assertEquals("0.49", kresp.getVersion());
+        assertEquals("seaweed", kresp.getName());
+        assertEquals("40.5s", kresp.getBenchmark());
+        assertEquals("10.0.10.14:678", kresp.getListener());
+        assertEquals("tanja", kresp.getNode());
+        assertTrue(kresp.hasTimeExceeded());
+        assertTrue(kresp.hasWarnings());
+
+
+        jsonResponse = "{\"warnings\":[[123,\"This is a warning\"]," +
+            "[124,\"This is a second warning\"]],"+
+            "\"error\":[[125,\"This is a single error\"]], "+
+            " \"node\":\"tanja\", \"version\":\"seaweed-0.49\", " +
+            " \"benchmark\":\"40.5s\",  \"listener\":\"10.0.10.14:678\"," +
+            "\"timeExceeded\":true }";
+        kresp = mapper.readValue(jsonResponse, KorapResponse.class);
+
+        /*
+{,"version":"seaweed-0.49","timeExceeded":true,"node":"tanja","listener":"10.0.10.14:678","benchmark":"40.5s"}
+        */
+        // System.err.println(kresp.toJsonString());
     };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/server/TestResource.java b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
index 1096d89..c6014f7 100644
--- a/src/test/java/de/ids_mannheim/korap/server/TestResource.java
+++ b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
@@ -64,73 +64,73 @@
 
     @Test
     public void testResource() throws IOException {
-	KorapResponse kresp;
+        KorapResponse kresp;
 
-	for (String i : new String[] {"00001",
-				      "00002",
-				      "00003",
-				      "00004",
-				      "00005",
-				      "00006",
-				      "02439"
-	    }) {
+        for (String i : new String[] {"00001",
+                                      "00002",
+                                      "00003",
+                                      "00004",
+                                      "00005",
+                                      "00006",
+                                      "02439"
+            }) {
 
-	    String json = StringfromFile(getClass().getResource("/wiki/" + i + ".json").getFile());
-	    kresp = target.path("/index/" + i).
-		request("application/json").
-		put(Entity.json(json), KorapResponse.class);
+            String json = StringfromFile(getClass().getResource("/wiki/" + i + ".json").getFile());
+            kresp = target.path("/index/" + i).
+                request("application/json").
+                put(Entity.json(json), KorapResponse.class);
 
-	    assertEquals(kresp.getNode(), "milena");
-	    assertFalse(kresp.hasErrors());
-	    assertFalse(kresp.hasWarnings());
-	    assertFalse(kresp.hasMessages());
-	};
+            assertEquals(kresp.getNode(), "milena");
+            assertFalse(kresp.hasErrors());
+            assertFalse(kresp.hasWarnings());
+            assertFalse(kresp.hasMessages());
+        };
 
-	kresp = target.path("/index").
-	    request("application/json").
-	    post(Entity.text(""), KorapResponse.class);
-	assertEquals(kresp.getNode(), "milena");
-	assertFalse(kresp.hasErrors());
-	assertFalse(kresp.hasWarnings());
-	assertFalse(kresp.hasMessages());
+        kresp = target.path("/index").
+            request("application/json").
+            post(Entity.text(""), KorapResponse.class);
+        assertEquals(kresp.getNode(), "milena");
+        assertFalse(kresp.hasErrors());
+        assertFalse(kresp.hasWarnings());
+        assertFalse(kresp.hasMessages());
     };
 
     @Test
     public void testCollection() throws IOException {
 
-	String json = getString(
-	    getClass().getResource("/queries/bsp-uid-example.jsonld").getFile()
+        String json = getString(
+            getClass().getResource("/queries/bsp-uid-example.jsonld").getFile()
         );
 
-	 KorapResponse kresp
-	    = target.path("/").
-	    queryParam("uid", "1").
-	    queryParam("uid", "4").
-	    request("application/json").
-	    post(Entity.json(json), KorapResponse.class);
-	 /*
-	 assertEquals(2, kresp.getTotalResults());
-	 */
-	 fail("totalResults should be implemented in KorapResponse" +
-	      " or KorapResult should be used here");
-	 assertFalse(kresp.hasErrors());
-	 assertFalse(kresp.hasWarnings());
-	 assertFalse(kresp.hasMessages());
+        KorapResponse kresp
+            = target.path("/").
+            queryParam("uid", "1").
+            queryParam("uid", "4").
+            request("application/json").
+            post(Entity.json(json), KorapResponse.class);
+        /*
+          assertEquals(2, kresp.getTotalResults());
+        */
+        fail("totalResults should be implemented in KorapResponse" +
+             " or KorapResult should be used here");
+        assertFalse(kresp.hasErrors());
+        assertFalse(kresp.hasWarnings());
+        assertFalse(kresp.hasMessages());
     };
 
     public static String getString (String path) {
-	StringBuilder contentBuilder = new StringBuilder();
-	try {
-	    BufferedReader in = new BufferedReader(new FileReader(path));
-	    String str;
-	    while ((str = in.readLine()) != null) {
-		contentBuilder.append(str);
-	    };
-	    in.close();
-	} catch (IOException e) {
-	    fail(e.getMessage());
-	}
-	return contentBuilder.toString();
+        StringBuilder contentBuilder = new StringBuilder();
+        try {
+            BufferedReader in = new BufferedReader(new FileReader(path));
+            String str;
+            while ((str = in.readLine()) != null) {
+                contentBuilder.append(str);
+            };
+            in.close();
+        }
+        catch (IOException e) {
+            fail(e.getMessage());
+        };
+        return contentBuilder.toString();
     };
-
 };
