diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/EmptyFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/EmptyFetchOptions.java
index 0ea9e8d80d33ee4e691cb0ca33da483aa641e15e..e8853643f58c8cb1acf0bcd4339e3efb291695f1 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/EmptyFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/EmptyFetchOptions.java
@@ -20,4 +20,10 @@ public class EmptyFetchOptions extends FetchOptions<Void>
         return null;
     }
 
+    @Override
+    public FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
+    {
+        return new FetchOptionsToStringBuilder("Empty", this);
+    }
+
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptions.java
index 0f740ad00138ad9c83b8d10fc0048f08408e7c60..d98b47624fc3f7ad911dfeedd953728a37a15d29 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptions.java
@@ -58,13 +58,7 @@ public abstract class FetchOptions<OBJECT> implements Serializable
 
     public abstract SortOptions<OBJECT> getSortBy();
 
-    @JsonIgnore
-    public FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
-    {
-        FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("?", this);
-        f.setName("kuba");
-        return f;
-    }
+    protected abstract FetchOptionsToStringBuilder getFetchOptionsStringBuilder();
 
     @Override
     public String toString()
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptionsToStringBuilder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptionsToStringBuilder.java
index fd5c2f3049762465edddb078af95ee9efbc6692e..38f87e91a3e49a696deb06acb6873827d71c3a95 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptionsToStringBuilder.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/FetchOptionsToStringBuilder.java
@@ -21,9 +21,12 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Set;
 
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
 /**
- * @author pkupczyk
+ * @author jakubs
  */
+@JsonObject("as.dto.common.fetchoptions.FetchOptionsToStringBuilder")
 public class FetchOptionsToStringBuilder
 {
     private String name;
@@ -42,12 +45,6 @@ public class FetchOptionsToStringBuilder
         this.keys = new ArrayList<>();
     }
 
-    public FetchOptionsToStringBuilder setName(String name)
-    {
-        this.name = name;
-        return this;
-    }
-
     public FetchOptionsToStringBuilder addFetchOption(String key, FetchOptions<?> fo)
     {
         childrenFetchOptions.put(key, fo);
@@ -62,7 +59,13 @@ public class FetchOptionsToStringBuilder
 
         if (indentation.isEmpty())
         {
-            sb.append(this.name + "\n");
+            if (this.mainFetchOptions.getSortBy() != null)
+            {
+                sb.append(this.name + " " + this.mainFetchOptions.getSortBy() + "\n");
+            } else
+            {
+                sb.append(this.name + "\n");
+            }
         }
 
         processed.add(this.mainFetchOptions);
@@ -74,13 +77,19 @@ public class FetchOptionsToStringBuilder
             FetchOptions<?> subOptions = childrenFetchOptions.get(key);
             if (subOptions != null)
             {
+                String sortOptionsPart = "";
+                if (subOptions.getSortBy() != null)
+                {
+                    sortOptionsPart = " " + subOptions.getSortBy();
+                }
+
                 FetchOptionsToStringBuilder sbb = subOptions.getFetchOptionsStringBuilder();
                 if (processed.contains(subOptions))
                 {
-                    sb.append(indentation + "with " + key + "(recursive) \n");
+                    sb.append(indentation + "with " + key + sortOptionsPart + "(recursive)\n");
                 } else
                 {
-                    sb.append(indentation + "with " + key + "\n");
+                    sb.append(indentation + "with " + key + sortOptionsPart + "\n");
                     sb.append(sbb.toString(indentation, processed));
                 }
             }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOptions.java
index 7e56b0ad2f08906078eba6b49185e839b556aa77..cf61e87b238beb502c9422897090530267320fee 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOptions.java
@@ -17,6 +17,7 @@
 package ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -61,4 +62,14 @@ public abstract class SortOptions<OBJECT> implements Serializable
         return sortings;
     }
 
+    @Override
+    public String toString()
+    {
+        List<String> strings = new ArrayList<>();
+        for (Sorting sort : sortings)
+        {
+            strings.add(sort.toString());
+        }
+        return String.join(", ", strings);
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOrder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOrder.java
index e9a95aa48b6d9b8513a8cb48809d0bb935852521..7731cf429147b4877f2fa51819fa08ebcd384901 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOrder.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/SortOrder.java
@@ -46,4 +46,9 @@ public class SortOrder implements Serializable
         return asc;
     }
 
+    @Override
+    public String toString()
+    {
+        return isAsc() ? "ASC" : "DESC";
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/Sorting.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/Sorting.java
index 3c45afce39787ec15f71dbde9c51125dcb4cfa14..4f819b261acb16fe341ddadf27bcf567392149cd 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/Sorting.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/fetchoptions/Sorting.java
@@ -54,4 +54,9 @@ public class Sorting implements Serializable
         return order;
     }
 
+    @Override
+    public String toString()
+    {
+        return "order by " + field + " " + order;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java
index ccf178295eeb7a2d7e20e30bb8e086f4517850ab..63fbef3f5113329ca2c9b50e6b8fd0d204550a1b 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptionsToStringBuilder;
 import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
@@ -49,4 +50,10 @@ public class DataSetFileFetchOptions extends FetchOptions<DataSetFile> implement
     {
         return sort;
     }
+
+    @Override
+    protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
+    {
+        return new FetchOptionsToStringBuilder("DataSetFile", this);
+    }
 }