diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java index b7c2f13b6..5576e19a9 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java @@ -74,7 +74,7 @@ public class JsonEntitySerializer extends JsonSerializer { } } - if (StringUtils.isNotBlank(entity.getType()) && format == ODataFormat.JSON_FULL_METADATA) { + if (StringUtils.isNotBlank(entity.getType()) && format != ODataFormat.JSON_NO_METADATA) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.TYPE), new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external(version)); } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java index b6f857f5e..6955b11a8 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java @@ -314,7 +314,7 @@ public class JsonSerializer implements ODataSerializer { throws IOException, EdmPrimitiveTypeException { jgen.writeStartObject(); - if (typeInfo != null && format == ODataFormat.JSON_FULL_METADATA) { + if (typeInfo != null && format != ODataFormat.JSON_NO_METADATA) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.TYPE), typeInfo.external(version)); } @@ -361,7 +361,7 @@ public class JsonSerializer implements ODataSerializer { if (StringUtils.isBlank(type) && valuable.isPrimitive() || valuable.isNull()) { type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(); } - if (StringUtils.isNotBlank(type) && format == ODataFormat.JSON_FULL_METADATA) { + if (StringUtils.isNotBlank(type) && format != ODataFormat.JSON_NO_METADATA) { jgen.writeFieldName( name + StringUtils.prependIfMissing(version.getJsonName(ODataServiceVersion.JsonKey.TYPE), "@")); jgen.writeString(new EdmTypeInfo.Builder().setTypeExpression(type).build().external(version));