diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java index d38dff08145..8aa98cdb0e5 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java @@ -2486,6 +2486,14 @@ private HttpBinding readPayload( Location.PAYLOAD, "data", binding.getMember(), target)); } ); + } else if (target instanceof StructureShape) { + writer.write("contents.$L = $L;", binding.getMemberName(), getOutputValue(context, + Location.PAYLOAD, "data", binding.getMember(), target)); + // Handle empty objects for structure shapes - convert to null + writer.write("if (contents.$L && Object.keys(contents.$L).length === 0) {", + binding.getMemberName(), binding.getMemberName()); + writer.write(" contents.$L = null;", binding.getMemberName()); + writer.write("}"); } else { writer.write("contents.$L = $L;", binding.getMemberName(), getOutputValue(context, Location.PAYLOAD, "data", binding.getMember(), target));