diff --git a/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java b/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java
@@ -72,7 +72,8 @@ public class OJSONFetchContext implements OFetchContext {
     StringBuilder buffer = typesStack.pop();
     if (keepTypes && buffer.length() > 0)
       try {
-        jsonWriter.writeAttribute(indentLevel + 1, true, ORecordSerializerJSON.ATTRIBUTE_FIELD_TYPES, buffer.toString());
+        jsonWriter.writeAttribute(indentLevel > -1 ? indentLevel + 1 : -1, true, ORecordSerializerJSON.ATTRIBUTE_FIELD_TYPES,
+            buffer.toString());
       } catch (IOException e) {
         throw new OFetchException("Error writing field types", e);
       }
Fixed issue #<I> about extra characters in returning JSON from server