diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/BasicContainerSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/BasicContainerSerializer.cpp index 400a3b7949..525e42a1dd 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/BasicContainerSerializer.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/BasicContainerSerializer.cpp @@ -102,6 +102,17 @@ namespace AZ return context.Report(retVal, "Processing of basic container was halted."); } + // If each container element was 'DefaultsUsed', then the result code will be 'DefaultsUsed' + // But this is wrong if the container has at least one element, because a container with + // at least one element is certainly not the default container value. + // Basically, the following are different objects: + // [ {} ] // The container which has only default elements, but is not the empty container + // {} // The default container, which is empty + if (index > 0) + { + retVal.Combine(JSR::ResultCode(JSR::Tasks::WriteValue, JSR::Outcomes::Success)); + } + if (context.ShouldKeepDefaults()) { outputValue = AZStd::move(array);