diff --git a/addon-json/src/main/java/org/springframework/roo/addon/json/JsonMetadata.java b/addon-json/src/main/java/org/springframework/roo/addon/json/JsonMetadata.java index 59063d7b42..19cd6d02ab 100644 --- a/addon-json/src/main/java/org/springframework/roo/addon/json/JsonMetadata.java +++ b/addon-json/src/main/java/org/springframework/roo/addon/json/JsonMetadata.java @@ -255,7 +255,7 @@ private MethodMetadataBuilder getToJsonArrayMethod(boolean includeParams) { bodyBuilder .appendFormalLine( (!includeParams ? "" : ".include(fields)") - + ".exclude(\"*.class\")" + + (!includeParams ? ".exclude(\"*.class\")": ".exclude(\"*\")") + (annotationValues.isDeepSerialize() ? ".deepSerialize(collection)" : ".serialize(collection)") + ";"); @@ -306,7 +306,7 @@ private MethodMetadataBuilder getToJsonMethod(boolean includeParams) { } bodyBuilder.appendFormalLine( (!includeParams ? "" : ".include(fields)") - + ".exclude(\"*.class\")" + + (!includeParams ? ".exclude(\"*.class\")": ".exclude(\"*\")") + (annotationValues.isDeepSerialize() ? ".deepSerialize(this)" : ".serialize(this)") + ";");