Support complex types in artifact properties
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / tosca / converters / ToscaValueBaseConverter.java
index ee25481..7505d2a 100644 (file)
@@ -98,12 +98,19 @@ public class ToscaValueBaseConverter {
     }
 
     private Map<String, Object> handleJsonObject(final JsonElement jsonElement) {
-        final Map<String, Object> jsonObjectAsMap = new HashMap<>();
         final JsonObject jsonObject = jsonElement.getAsJsonObject();
+        if (jsonObject.entrySet().isEmpty()) {
+            return null;
+        }
+        final Map<String, Object> jsonObjectAsMap = new HashMap<>();
         for (final Entry<String, JsonElement> entry : jsonObject.entrySet()) {
-            jsonObjectAsMap.put(entry.getKey(), handleComplexJsonValue(entry.getValue()));
+            final Object value = handleComplexJsonValue(entry.getValue());
+            if (value != null) {
+                jsonObjectAsMap.put(entry.getKey(), value);
+            }
+
         }
-        return jsonObjectAsMap;
+        return jsonObjectAsMap.isEmpty() ? null : jsonObjectAsMap;
     }
 
     private List<Object> handleJsonArray(final JsonElement entry) {