diff --git a/src/cognitect/aws/shape.clj b/src/cognitect/aws/shape.clj index 77370813..736d174b 100644 --- a/src/cognitect/aws/shape.clj +++ b/src/cognitect/aws/shape.clj @@ -165,7 +165,11 @@ (defmethod json-serialize* "structure" [shapes shape data] - (when data + (cond + (:document shape) + data + + data (reduce-kv (fn [m k v] (if-let [member-shape (resolve shapes (structure-member-shape-ref shape k))] (assoc m diff --git a/test/src/cognitect/aws/shape_test.clj b/test/src/cognitect/aws/shape_test.clj index de9239c7..408bfe54 100644 --- a/test/src/cognitect/aws/shape_test.clj +++ b/test/src/cognitect/aws/shape_test.clj @@ -32,3 +32,9 @@ (shape/json-parse* {} {:type "structure" :document true} [{:this "is" :a "doc"}]))))) + +(deftest test-json-serialize + (is (= "{\"this\":\"is\",\"a\":\"doc\"}" + (shape/json-serialize {} + {:type "structure", :members {}, :document true} + {:this "is" :a "doc"}))))