From 63a5af05e55025698cf6e19add56390d014e4f4f Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 22 Dec 2020 16:01:19 -0500 Subject: [PATCH] Document behaviour of squash when decoding struct->map --- mapstructure.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mapstructure.go b/mapstructure.go index 5aee9bdb..0a5eb30d 100644 --- a/mapstructure.go +++ b/mapstructure.go @@ -72,6 +72,17 @@ // "name": "alice", // } // +// When decoding from a struct to a map, the squash tag squashes the struct +// fields into a single map. Using the example structs from above: +// +// Friend{Person: "alice"} +// +// Will be decoded into a map: +// +// map[string]interface{}{ +// "name": "alice", +// } +// // DecoderConfig has a field that changes the behavior of mapstructure // to always squash embedded structs. //